idchlife / express-list-routes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

express-list-routes

List all routes used in Express.

NPM Version NPM Downloads

var expressListRoutes   = require('express-list-routes'),
    express             = require('express'),
    router              = express.Router();

app.use('/api/v1', router);

router.route('/user')
  .post(fn)
  .get(fn)
  .put(fn);
    
expressListRoutes({ prefix: '/api/v1' }, 'API:', router );

Will output

API:
POST   /api/v1/user
GET    /api/v1/user
PUT    /api/v1/user

Installation

$ npm install express-list-routes --save

Options

You can pass any three aguments of either a String Express Router or Options

Options Object

  {
    prefix: '', // The prefix for router Path
    spacer: 7   // Spacer between router Method and Path
  }

About


Languages

Language:JavaScript 100.0%