From ff1454d061c835047f4ca594177715e05e820497 Mon Sep 17 00:00:00 2001 From: Utopiah Date: Mon, 23 Oct 2023 10:50:48 +0200 Subject: [PATCH] list all routes in HTML to make them clickable --- index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.js b/index.js index b980638..661d163 100644 --- a/index.js +++ b/index.js @@ -116,6 +116,13 @@ app.use(function(req, res, next) { app.get('/', (req, res) => { res.send( instructions ) + // see issue 20 +}) + +app.get('/routes', (req, res) => { + let routes = app._router.stack.map( r => r.route?.path ).filter( r => typeof(r) == 'string' ) + let formattedRoutes = routes.map( r => `
  • ${r}
  • ` ).join('\n') + res.send( formattedRoutes ) }) app.get('/authtestviaheader', (req, res) => {