https://github.com/luisvinicius167/diet-group-router
A grouping route module for Diet.js.
https://github.com/luisvinicius167/diet-group-router
Last synced: 3 months ago
JSON representation
A grouping route module for Diet.js.
- Host: GitHub
- URL: https://github.com/luisvinicius167/diet-group-router
- Owner: luisvinicius167
- License: mit
- Created: 2017-01-17T20:44:46.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-27T11:41:15.000Z (over 7 years ago)
- Last Synced: 2025-01-17T12:16:22.250Z (4 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# diet-group-routes
> A grouping route module for Diet.js.
## Install
```
npm install diet-group-router
```## The Gist:
```javascript
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
```javascript
app.group('/users').then( app => {
app.post('/register', controller.register);
});
```