mikec / kalamata

Extensible REST API for Express + Bookshelf.js
MIT License
41 stars 12 forks source link

Before/After hooks #8

Open mintyPT opened 7 years ago

mintyPT commented 7 years ago

Is it possible to have a hook to be fired before/after every endpoint?

For example, the before hook coold be used to protect all the routes.

nabilfreeman commented 7 years ago

This could also be useful for wrapping the results like so:

{
    "success": true,
    "data": {{kalamata data here}}
}

which is a fairly common REST API pattern.