/felid-group

A Felid.js plugin for grouping routes.

Primary LanguageJavaScriptMIT LicenseMIT

felid-group

npm version Node.js CI JavaScript Style Guide codecov

Add api for grouping routes in Felid.

Install

npm install felid-group

or

yarn add felid-group

Usage

const Felid = require('felid')
const group = require('felid-group')

const app = new Felid()
app.plugin(group, options)
const api = app.group('/api')
// /api/get
api.get('/get', (req, res) => {
  res.send('test')
}))
// /api/post
api.post('/post', (req, res) => {
  res.send('test')
}))
// make nested routing group: /api/v1/get
api.group('/v1').get('/get', (req, res) => {
  res.send('test')
}))

Options

  • decorator Object: Customize the decorator names. Default is:
{
  group: 'group'
}

API

  • felid.group(prefix: String) => Object

License

MIT