I'm not very good with regular expressions, so I want to make sure I'm doing this correctly. Let's say I have two very similar routes, /discussion/:slug/
and /page/:slug/
. I want to create a route that matches both these pages.
app.get('/[discussion|page]/:slug', function(req, res, next) {
...enter code here...
})
Is this the correct way to do it? Right now I'm just creating two separate routes.
someFunction = function(req, res, next) {..}
app.get('/discussion/:slug', someFunction)
app.get('/page/:slug', someFunction)