express-get-routes

Extracts Route information out of an express application or router. The format of the routes is the following:

Usage no npm install needed!

<script type="module">
  import expressGetRoutes from 'https://cdn.skypack.dev/express-get-routes';
</script>

README

express-get-routes

Extracts Route information out of an express application or router. The format of the routes is the following:

interface Route {
  path : string;
  methods : {
    get? : boolean;
    post? : boolean;
    put? : boolean;
    delete? : boolean;
  }
}

Usage

import * as express from 'express';
import {getRoutes} from 'express-get-routes';

let app = express();
// ... setup app

// contains an array of routes
let routes = getRoutes(app);

// print every route to the console
routes.forEach((route) => {
  console.log(route.path);
})