Skip to content

App.use(path, ...) Does Not Mount at '//' #4557

Description

@gebbber

Router instance mounted explicitly at '//' exposes routes when path begins only with a single /:

const TestRoutes = express.Router();

TestRoutes.get('/drop/table/:table', (req, res) => { 
  // drop table
  res.send(`Dropped table '${req.params.table}'`);
})

TestRoutes.get('/', sendListOfTestRoutes);

if (TEST) app.use('//', TestRoutes);

app.listen();

Expected behavior is that navigating to http://hostname/ would bypass this Router and go to the main app, but instead Express serves the list of test routes mounted within the router at //.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions