Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kamalyb/express-list-routes

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kamalyb/express-list-routes

Typescript'd fork of express-list-routes

  • 1.1.10
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

express-list-routes

A typescript'd fork of express-list-routes solely as a result of personal need

Example App

import express, { Express } from "express";
import expressListRoutes from "@kamalyb/express-list-routes";

const app: Express = express();

app.get("/health", fn);

app.use("/admin", router);
router.route("/user").post(fn).get(fn).put(fn);

List all Routes with prefix

expressListRoutes(app, { prefix: "/api/v1" });
// Logs out the following:
// GET    /api/v1/health
// POST   /api/v1/admin/user
// GET    /api/v1/admin/user
// PUT    /api/v1/admin/user

Or only log out nested router routes

expressListRoutes(router);
// Logs out the following:
// POST   /admin/user
// GET    /admin/user
// PUT    /admin/user

Installation

npm install @kamalyb/express-list-routes
yarn add @kamalyb/express-list-routes

Options

You can pass a second argument to set some options

  {
    prefix: '', // A prefix for router Path
    spacer: 7   // Spacer between router Method and Path
  }

Migrations

0.1 -> 1.0

The order of the params have changed, and dropped support for freeform text.

BEFORE 0.1<

expressListRoutes({ prefix: '/api/v1' }, 'API:', router);

AFTER 1.0+

expressListRoutes(router, { prefix: '/api/v1' });

Keywords

FAQs

Package last updated on 24 Nov 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc