Expose all routes with methods and sort them

273 views
Skip to first unread message

Max Kramnik

unread,
Nov 1, 2011, 12:29:48 PM11/1/11
to Express
Hello,

What would be a better way to show all system routes and if needed to
sort them?
I wonder if Expressjs would give me this option or if I could expand
it?

Thanks,

max

Olivier Vaillancourt

unread,
Nov 16, 2011, 10:26:45 AM11/16/11
to expre...@googlegroups.com
You could check the  "express-on-railway" extension for express.


It comes with a command line tool that has a "print routes map" feature which you could use for that.

That said e-o-r constraints you to a precise directory/file layout I think, which might not be ideal if your website is already up.

Having to do this, I would strongly consider writing the code myself. You can access pretty much all of your routes information through app.routes.routes. Ordering them alphabetically and grouping them by verb should be pretty straightforward... (There might be a faster/cleaner way to do it though.)

-Olivier


--
You received this message because you are subscribed to the Google Groups "Express" group.
To post to this group, send email to expre...@googlegroups.com.
To unsubscribe from this group, send email to express-js+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/express-js?hl=en.


vision media [ Tj Holowaychuk ]

unread,
Nov 16, 2011, 10:59:08 AM11/16/11
to expre...@googlegroups.com
https://gist.github.com/1288766

is an example, I'll be refining this API a bit for the next release to make
it a bit easier.
--
Tj Holowaychuk
Vision Media
President & Creative Lead
Reply all
Reply to author
Forward
0 new messages