List all routes in Vapor

Viewed 554

I want to inspect a list of all routes, that Vapor app is serving. Is there a script or a run-time command that will generate the list for me?

I'm looking for something similar to rake routes in Ruby on Rails

2 Answers

Run vapor run routes from the command line after executing vapor build

Another alternative to get the routes use the following command. It will build your project and displays all routes registered to the Application's Router in an ASCII-formatted table.

 $ swift run Run routes

 +------+------------------+
 | GET  | /search          |
 +------+------------------+
 | GET  | /hash/:string    |
 +------+------------------+

A colon preceding a path component indicates a variable parameter. A colon with no text following is a parameter whose result will be discarded.

Related