In the previous episode we created a new Luminus application, set up a
PostgreSQL database, wrote queries to insert and retrieve pages, and added a
route and template to tie it all together. In this episode we’ll finish our
wiki, and with that conclude our grand tour of Luminus.
If you didn’t follow along you can
grab the code from GitHub
instead. Start from the
part-1 branch, and follow the instructions in the
README to set up your database.
I’m just going to start from where we left off. In Emacs, I’ll open a Clojure
file within the project so I can jack in CIDER and get a REPL.
Let’s have another look of what we have so far. Start the app and open it in a
;; Start a connected REPL. For Emacs/CIDER: M-x cider-jack-in
We got redirected to
/home, but we can’t yet edit the page. We created this
page last time from the REPL, but we can’t expect our users to do the same!
We’ll need two new routes, which we’ll add to
home.clj. One that shows the
form to edit a page, and one that handles the form submission. We haven’t used
the POST function before, so don’t forget to refer to it in the namespace