2.0.6 • Published 3 years ago
list_end_points v2.0.6
listEndPoints
A simple utility to list all registered endpoints in an Express.js application, including their HTTP methods, middleware names, and paths.
Installation
npm install list_end_pointsUsage
// in typescript
import express, { Application } from "express";
import listEndpoints from "list_end_points";
const app: Application = express();
// Define your routes and middleware here
// ...
// Display registered endpoints in the console
listEndpoints(app);// in javascript
const express = require("express");
const listEndpoints = require("list_end_points");
const app = express();
// Define your routes and middleware here
// ...
// Display registered endpoints in the console
listEndpoints.default(app);This will output the registered endpoints in the following format:
1 GET /api/users
2 POST /api/users
3 PUT /api/users/:id
4 DELETE /api/users/:id
4 endpoints registeredAPI
listEndpoints(app: Express.Application): Endpoint[]
app: An instance of an Express.js application. Returns an array of Endpoint objects, where eachEndpointhas the following properties:- methods: An array of strings representing the HTTP methods associated with the endpoint.
- middlewares: An array of strings representing the names of the middleware functions associated with the endpoint.
- path: A string representing the endpoint's path.
License
ISC