
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
express-list-endpoints
Advanced tools
A express package to list all registered endpoints and its verbs
[!IMPORTANT] This package only works for express 4.* versions. It's not compatible with express 5 yet.
Express endpoint parser to retrieve a list of the passed router with the set verbs.
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);
app
- Express app
or router
instanceYour 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.
Running test:
npm test
Express List Endpoints is MIT licensed.
v7.1.1 - 2024-11-20
FAQs
A express package to list all registered endpoints and its verbs
The npm package express-list-endpoints receives a total of 58,134 weekly downloads. As such, express-list-endpoints popularity was classified as popular.
We found that express-list-endpoints demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.