[Solved] Regexp in express get request


You don’t need a regex for this, you can use URL parameters.

app.get('/foo/bar/:slug',
    function(req, res, next) {
        console.log(req.params.slug);
        next();
    }
);

Requesting /foo/bar/myImage.jpg would populate req.params.slug with 'myImage.jpg'.

2

solved Regexp in express get request