Attach hooks to a single route.
module.exports = {
paths: '/',
before: function (state) {
state.data.message = 'Hello'
},
handler: function (state) {
return state.data.message
},
after: function (state) {
state.result += ' world!'
}
}
before, after, and error can also name files under app/hooks, such as before: 'account/check'.
Next: Middleware →