express-list-endpoints
    DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/express-list-endpoints package

    6.0.0 • Public • Published

    Express List Endpoints

    Build Status codecov.io Maintainability

    NPM

    Express endpoint parser to retrieve a list of the passed router with the set verbs.

    Example of use

    const listEndpoints = require('express-list-endpoints')
    
    let app = require('express')();
    
    app.route('/')
      .all(function namedMiddleware(req, res) {
        // Handle request
      })
      .get(function(req, res) {
        // Handle request
      })
      .post(function(req, res) {
        // Handle request
      });
    
    app.route('/about')
      .get(function(req, res) {
        // Handle request
      });
    
    console.log(listEndpoints(app));
    
    /* It omits the 'all' verbs.
    [{
        path: '/',
        methods: ['GET', 'POST'],
        middlewares: ['namedMiddleware', 'anonymous', 'anonymous']
      },
      {
        path: '/about',
        methods: ['GET'],
        middlewares: ['anonymous']
    }]
    */

    Arguments

    app - Express app or router instance

    Your router instance (router) or your app instance (app).

    Note: Pay attention that before call this script the router or app must have the endpoints registered due to detect them.

    license

    MIT

    Install

    npm i express-list-endpoints

    DownloadsWeekly Downloads

    59,220

    Version

    6.0.0

    License

    MIT

    Unpacked Size

    16.8 kB

    Total Files

    8

    Last publish

    Collaborators

    • albertofdzm