Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all routes in Vapor

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

like image 583
Tomasz Bąk Avatar asked Mar 05 '23 01:03

Tomasz Bąk


2 Answers

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

like image 82
0xTim Avatar answered Mar 16 '23 04:03

0xTim


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.

like image 22
Razib Mollick Avatar answered Mar 16 '23 04:03

Razib Mollick