November 2018
Intermediate to advanced
404 pages
10h 16m
English
This route renders a new form so a user can submit a new entry:
app.router.get("/journal/create") { request, response, next in response.headers["Content-Type"] = "text/html; charset=utf-8" try response.render("new", context: ["title": title, "author": author]) }
It doesn't do too much except tell the response to render the new.stencil template. The follow web page will be generated if you point your web browser to localhost8080:/journal/create:

Once the form's data is filled and submitted to /journal/new via HTTP POST, the data will be processed accordingly to create a new entry in JournalController:
app.router.post("/journal/new") ...Read now
Unlock full access