New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-list-endpoints

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-list-endpoints - npm Package Compare versions

Comparing version 7.0.0 to 7.1.0

dist/index.d.ts

10

CHANGELOG.md

@@ -15,4 +15,14 @@ # Changelog

### Security
### Dev
-->
## 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.
## v7.0.0 - 2024-04-06

@@ -19,0 +29,0 @@

51

package.json
{
"name": "express-list-endpoints",
"version": "7.0.0",
"description": "A express package to list all registered endoints and its verbs",
"main": "src/index.js",
"scripts": {
"lint": "eslint \"**/*.js\"",
"test": "mocha",
"preversion": "npm run lint && npm test",
"version": "changelog-version && git add CHANGELOG.md",
"postversion": "git push --follow-tags"
"version": "7.1.0",
"description": "A express package to list all registered endpoints and its verbs",
"license": "MIT",
"repository": "AlbertoFdzM/express-list-endpoints",
"engines": {
"node": ">=18"
},
"repository": {
"type": "git",
"url": "https://github.com/AlbertoFdzM/express-list-endpoints.git"
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"keywords": [
"endpoint",
"endpoints",
"express",
"routes",
"endpoints",
"route",
"endpoint",
"list",
"ls",
"methods",
"middlewares",
"paths",
"route",
"routes",
"verb",
"verbs"
],
"author": "Alberto Fernandez <albertofdzm@gmail.com>",
"license": "MIT",
"engines": {
"node": ">=18"
"scripts": {
"build": "tsc",
"lint": "tsc --noEmit && eslint .",
"postversion": "git push --follow-tags",
"prebuild": "rimraf dist",
"preversion": "npm run lint && npm test",
"test": "mocha",
"version": "changelog-version && git add CHANGELOG.md"
},
"devDependencies": {
"chai": "^4.4.1",
"@types/express": "^4.17.21",
"chai": "^4.3.4",
"changelog-version": "^2.0.0",

@@ -42,4 +45,6 @@ "eslint": "^8.57.0",

"express": "^4.19.2",
"mocha": "^10.4.0"
"mocha": "^10.4.0",
"rimraf": "^5.0.5",
"typescript": "^5.4.4"
}
}
# Express List Endpoints
[![Build Status](https://travis-ci.org/AlbertoFdzM/express-list-endpoints.svg?branch=master)](https://travis-ci.org/AlbertoFdzM/express-list-endpoints) [![codecov.io](https://codecov.io/github/AlbertoFdzM/express-list-endpoints/coverage.svg?branch=master)](https://codecov.io/github/AlbertoFdzM/express-list-endpoints?branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/de84aedb98256b62c3ef/maintainability)](https://codeclimate.com/github/AlbertoFdzM/express-list-endpoints/maintainability)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/AlbertoFdzM/express-list-endpoints/ci.yml?branch=main&logo=github)](https://github.com/AlbertoFdzM/express-list-endpoints/actions/workflows/ci.yml?query=branch%3Amain) [![Codecov Coverage Report](https://img.shields.io/codecov/c/github/AlbertoFdzM/express-list-endpoints/main)](https://codecov.io/github/AlbertoFdzM/express-list-endpoints?branch=main) [![Code Climate Maintainability Report](https://img.shields.io/codeclimate/maintainability/AlbertoFdzM/express-list-endpoints)](https://codeclimate.com/github/AlbertoFdzM/express-list-endpoints/maintainability) [![NPM Downloads](https://img.shields.io/npm/dm/express-list-endpoints)
](https://www.npmjs.com/package/express-list-endpoints) [![NPM License](https://img.shields.io/npm/l/express-list-endpoints)](https://www.npmjs.com/package/express-list-endpoints)
[![NPM](https://nodei.co/npm/express-list-endpoints.png)](https://nodei.co/npm/express-list-endpoints/)
[![NPM Package Page](https://img.shields.io/badge/express--list--endpoints-gray?label=npm&labelColor=c21104)](https://www.npmjs.com/package/express-list-endpoints)
Express endpoint parser to retrieve a list of the passed router with the set verbs.
## Example of use
## Examples of use
```javascript
const listEndpoints = require('express-list-endpoints')
const express = require('express');
const expressListEndpoints = require('express-list-endpoints');
let app = require('express')();
let app = express();

@@ -32,18 +34,49 @@ app.route('/')

console.log(listEndpoints(app));
const endpoints = expressListEndpoints(app);
/* It omits the 'all' verbs.
[{
console.log(endpoints);
/* It omits 'all' handlers.
[
{
path: '/',
methods: ['GET', 'POST'],
middlewares: ['namedMiddleware', 'anonymous', 'anonymous']
methods: [ 'GET', 'POST' ],
middlewares: [ 'namedMiddleware', 'anonymous', 'anonymous' ]
},
{
path: '/about',
methods: ['GET'],
middlewares: ['anonymous']
}]
methods: [ 'GET' ],
middlewares: [ 'anonymous' ]
}
]
*/
```
```typescript
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

@@ -61,3 +94,3 @@

Runnin test:
Running test:
```shell

@@ -64,0 +97,0 @@ npm test

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc