diet-group-router
v0.0.2
Published
A grouping route module for Diet.js.
Downloads
1
Readme
diet-group-routes
A grouping route module for Diet.js.
Install
npm install diet-group-router
The Gist:
const server = require('diet');
const app = server();
// require the diet-group-router module
require('diet-group-router')(app);
// Now you have the app.group method available
app.group('/users').then( app => {
//users/register
app.post('/register', controller.register);
//users/login
app.post('/login', controller.login);
//users/logout
app.post('/logout', controller.logout);
});
app.listen(8000)
API
app.group
: return a Promise with the app server instance
app.group('/users').then( app => {
app.post('/register', controller.register);
});