question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Programmatically get all routes

See original GitHub issue

Describe the problem

It is not a frustration, it is a feature request -

but in a project I would like to progammatically generate menu items using the routes available. This way, whenever I have new routes introduced, I immediately have them in the menu (with a bit of chances to show in a nice way).

Describe the proposed solution

I would like to see, as a suggestion that $app-navigation’s api get extended with a routes object that has a list or tree structure the represents the routes as currently present within the app. Then I can use that object to generate my menu or whatever feature I want to build

Alternatives considered

Just create a json file or static js object in the project that has all the menu items.

Importance

nice to have

Additional Information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Conduitrycommented, Aug 2, 2022

Not exactly a duplicate, but it feels like this could be folded into #1142.

0reactions
Tommertomcommented, Aug 5, 2022

Hi @larrybotha and @benmccann

Thanks for both pointers.

I will use this which is sufficint for my use case -giving an array of menu items for the app

const modules = import.meta.glob('./components/*.*');
const menuItems = Object.keys(modules).map((item) =>
		item.replace('./components/', '').replace('.svelte', '')
	);
console.log('MODULES & Menu', modules, menuItems);
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get a list of all routes in ASP.NET Core? - Stack Overflow
Insert code routes.MapRouteAnalyzer("/routes"); into Startup.cs as follows. ... Then you can access url of http://..../routes to view all route informations on ...
Read more >
How to list all routes in an ASP.NET Core application
In this post, I describe how to list all routes of an ASP.NET Core application using EndpointDataSource.
Read more >
Programmatically list all routes (/paths) from within a rails app.
Programmatically list all routes (/paths) from within a rails app. - rails_route_recognizer.rb.
Read more >
How to get a list of registered route paths in Laravel?
Using getRoutes() by using the Route class in web.php. The getRoutes() will return routeCollection that will hold all the route lists. use ...
Read more >
Routing and Action Selection in ASP.NET Web API
Action Selection · Create a list of all actions on the controller that match the HTTP request method. · If the route dictionary...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found