Socket
Socket
Sign inDemoInstall

express-list-endpoints

Package Overview
Dependencies
0
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    express-list-endpoints

A express package to list all registered endpoints and its verbs


Version published
Weekly downloads
63K
decreased by-13.94%
Maintainers
1
Install size
13.5 kB
Created
Weekly downloads
 

Changelog

Source

v7.1.0 - 2024-04-07

Added

  • Add logic for apps and routers with no routes to return an empty array.

Dev

  • Add TypeScript configuration and transpilation scripts.
  • Add types.

Readme

Source

Express List Endpoints

GitHub Actions Workflow Status Codecov Coverage Report Code Climate Maintainability Report NPM Downloads NPM License

NPM Package Page

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

Examples of use

const express = require('express');
const expressListEndpoints = require('express-list-endpoints');

let app = 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
  });

const endpoints = expressListEndpoints(app);

console.log(endpoints);

/* It omits 'all' handlers.
[
  {
    path: '/',
    methods: [ 'GET', 'POST' ],
    middlewares: [ 'namedMiddleware', 'anonymous', 'anonymous' ]
  },
  {
    path: '/about',
    methods: [ 'GET' ],
    middlewares: [ 'anonymous' ]
  }
]
*/
import express from 'express';
import expressListEndpoints from 'express-list-endpoints';

let app = 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
  });

const endpoints = expressListEndpoints(app);

console.log(endpoints);

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.

Contributing to express-list-endpoints

Development

Running test:

npm test

License

Express List Endpoints is MIT licensed.

Keywords

FAQs

Last updated on 07 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc