Comments (7)
Can you give me an example of nested routers.
You can pass each router as additional params i.e. expressListRoutes(routerA, routerB, routerC)
from express-list-routes.
You can mount apps to each other in Express 4, so I guess I would have to extract all of them.
from express-list-routes.
It's been a year since I touched this 😟, I will have to have a look at the router and see how and/or if they include reference to mounted expresses.
Can you share some snippets of how you have them mounted so I can replicate exactly ?
from express-list-routes.
Sure you can find it in documentation too:
var express = require('express');
var expressListRoutes = require('express-list-routes');
var app = express(); // the main app
var admin = express(); // the sub app
app.get('/', function (req, res) {
res.send('Index Homepage');
});
admin.get('/', function (req, res) {
console.log(admin.mountpath); // /admin
res.send('Admin Homepage');
});
app.use('/admin', admin); // mount the sub app
// expecting it to print the whole hierarchy
expressListRoutes(app._router);
I skimmed through but I couldn't find any way to actually enumerate linked apps. I think we would have to use private properties to achieve this.
from express-list-routes.
Great, thank you, I'll look into it. I can't promise to have anything soon for this though :(
In the meantime you can do this expressListRoutes(app._router, admin._router);
from express-list-routes.
Sure, not critical.
On Mar 2, 2016, at 3:07 PM, labithiotis [email protected] wrote:
Great, thank you, I'll look into it. I can't promise to have anything soon for this though :(
In the meantime you can do this expressListRoutes(app._router, admin._router);
—
Reply to this email directly or view it on GitHub #3 (comment).
from express-list-routes.
Just hit this myself, and spent a while trying to work out why my routers weren't working correctly before thinking to actually try it with cURL and see...
from express-list-routes.
Related Issues (12)
- List all routes in app HOT 2
- [Enhancement Suggestion] return router list as json object HOT 1
- custom logger has not been released HOT 1
- typescript typings HOT 3
- Unnecessary prefix on Windows HOT 2
- suppress logger HOT 2
- great work but can you tell us what it returns? HOT 1
- needs IRouter? HOT 1
- Is this library outdated? HOT 1
- Versions of lodash before 4.17.5 are vulnerable to prototype pollution. HOT 1
- Support custom logger HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from express-list-routes.