
Product
Socket Now Supports pylock.toml Files
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
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 67,729 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.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.
Research
Security News
Malicious Ruby gems typosquat Fastlane plugins to steal Telegram bot tokens, messages, and files, exploiting demand after Vietnam’s Telegram ban.