Instead of routing /hello via code you simply create a hello directory inside pages.
A page can have a template, style sheet, a controller, a client script and a JSON file:
hello/hello.pughello/hello.stylhello/hello.jshello/hello.client.jshello/hello.json
The hello.js controller is just an object that defines get or post methods. Or whatever you need.
exports.get = (request, response) => response.end('Hello')To feed dynamic data from a controller to a template we pass it to response.render:
response.render({
message: 'You requested ' + request.url
})In the hello.pug template we can now access message:
h1= message