An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

        

# diet-group-routes
> A grouping route module for Diet.js.

![Diet Logo](http://i.imgur.com/Dasjkkp.png)

## 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);
});
```