Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route summary tool #15

Closed
4 tasks
MonsieurMan opened this issue Oct 5, 2017 · 16 comments
Closed
4 tasks

Route summary tool #15

MonsieurMan opened this issue Oct 5, 2017 · 16 comments
Assignees
Labels

Comments

@MonsieurMan
Copy link
Contributor

As much as I like the module architecture, it introduces one issue, everything is split apart. In my case I ended up maintaining a file containing all my application routes.

So I thought that it would be really simple and useful to create a command like:
nest list routes
GET /api/v1/sncf/train-stop-names
POST /api/v1/sncf/train-departures
GET /api/v1/sncf/vehicle-journey

We could also display:

  • Guards
  • JSdoc
  • Async / Not
  • Return type

It would be simple to implement (crawling the .controler.ts files) and I think would be a great way to have an overview of the project and it maybe could lead to listing other framework object or even a documentation generator in case of an API.

I'm open to discussing the idea and I'd like to do it if you see any interest in it.

@thomrick
Copy link
Contributor

thomrick commented Oct 5, 2017

Hey @MonsieurMan !
I love your idea !

  • Maybe something like nest tree to list routes with module hierarchy should be awesome !
  • For Guards maybe use colors on route tree ;-)
  • For JSDoc swagger integration should be enough don't you think ?
  • Async / Not like previous point as return type

@adrien2p
Copy link

adrien2p commented Oct 5, 2017

@MonsieurMan ! Great Idea :)

@MonsieurMan
Copy link
Contributor Author

@thomrick Hey, just checked out swagger, it pretty much make this idea useless as for routes, but the nest tree idea is really nice.
We could build up a tree as JSON then displaying it to the CLI or anywhere else.

@thomrick thomrick self-assigned this Oct 5, 2017
@thomrick
Copy link
Contributor

thomrick commented Oct 5, 2017

OK cool ! I'll add tree command to the development plan !

@thomrick thomrick changed the title [ Feature Suggestion ] Route summary tool [ Feature ] Route summary tool Dec 20, 2017
@thomrick thomrick changed the title [ Feature ] Route summary tool [FEATURE] - Route summary tool Dec 20, 2017
@thomrick thomrick changed the title [FEATURE] - Route summary tool feature(tree): Route summary tool Apr 21, 2018
@thomrick thomrick changed the title feature(tree): Route summary tool Route summary tool Apr 26, 2018
@thomrick thomrick added this to To do in SPRINT 2 (19 points) via automation May 25, 2018
@thomrick thomrick removed this from To do in SPRINT 2 (19 points) Jun 5, 2018
@thomrick thomrick added the 8 label Jun 10, 2018
@thomrick thomrick added this to Needs triage in SPRINT 6 via automation Jun 17, 2018
@thomrick thomrick removed this from Needs triage in SPRINT 6 Jun 23, 2018
@thomrick thomrick added this to To do in SPRINT 4 (0 points) Jun 23, 2018
@thomrick thomrick removed the backlog label Jun 23, 2018
@thomrick thomrick added backlog and removed backlog labels Aug 4, 2018
@thomrick thomrick removed the minor label Sep 2, 2018
@thomrick thomrick removed this from To do in SPRINT 4 (0 points) Sep 4, 2018
@say8425
Copy link

say8425 commented May 13, 2020

Any some news?

@Kessir
Copy link

Kessir commented Jul 27, 2020

I'm willing to implement this if you can point me in the right direction @thomrick @kamilmysliwiec

Right now it's not clear what was agreed on

@sadhakbj
Copy link

sadhakbj commented Oct 4, 2020

Any updates on this?

@Pacheco95
Copy link

Something like adonis node ace list:routes will be awesome.

@Sikora00
Copy link
Contributor

crawling the .controler.ts files
If you implement it this way then you will display routes from not used modules.
If you use monorepo and have multiple apps, you won't have a clue which app is using which routes.

@Sikora00
Copy link
Contributor

@kamilmysliwiec Don't you want to include it in the CLI? I still though that it should be possible to achieve it by static analysis similar to what we are doing here https://github.com/valueadd-poland/ng-packages/tree/master/packages/linking-tool

@Sikora00
Copy link
Contributor

Is there any option to provide it as a plugin?

@jmcdo29
Copy link
Member

jmcdo29 commented Sep 23, 2021

I could see it being made as a standalone command (nest-routes or something). With the current setup of the Nest CLI it wouldn't be possible to add this in as a plugin for the CLI so you could do nest route.

@SkyLeite
Copy link

This is a very useful feature in Rails for me. Commenting here to show support.

@micalevisk
Copy link
Member

it should be possible to achieve it by static analysis

I don't think we can implement such feature without running the app, which ins't good because I don't want to start the app just to list all the routes 😞 Not easily, at least

That is because when we use the versioning feature, it's defined at runtime below

https://github.com/nestjs/nest/blob/31001bbb873a3468b9e5a61ab9ce35d2f1da7aee/packages/core/router/routes-resolver.ts#L92

@Neosoulink
Copy link

Any update for this one?

I mean, can we just at least read the controllers and display the routes, without having to run the app... or something like that?

@micalevisk
Copy link
Member

@Neosoulink I believe you can do that if you manage to replicate nestjs core router.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests