Git Product home page Git Product logo

Comments (7)

labithiotis avatar labithiotis commented on July 18, 2024

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.

pronebird avatar pronebird commented on July 18, 2024

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.

labithiotis avatar labithiotis commented on July 18, 2024

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.

pronebird avatar pronebird commented on July 18, 2024

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.

labithiotis avatar labithiotis commented on July 18, 2024

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.

pronebird avatar pronebird commented on July 18, 2024

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.

sazzer avatar sazzer commented on July 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.