Skip to content

Double slash before Router (router//route) #4427

Closed
@checnev

Description

@checnev

Hello, when i assign a router to the route, then there is access to routes with a double slash at the beginning.

example:

const express = require('express');
const app = express();
const port = 3000;

const router = express.Router({ strict: true }); // i've tried without strict mode
router.get('/test', (req, res) => {
  res.send('test');
});

app.use('/user', router);

app.listen(port, () => console.log(`app listening on port ${port}!`))

The router is supposed to run on the /user/test route, but the /user//test also works.

Environment:

"node": 14.3.0
"express": 4.17.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions