express router depending on url code example
Example 1: node js express url parameters
app.get('/api/:version', function(req, res) {
res.send(req.params.version);
});
Example 2: widlicard in express router
app.get('/ab?cd', function (req, res) {
res.send('ab?cd')
})
app.get('/ab+cd', function (req, res) {
res.send('ab+cd')
})
app.get('/ab*cd', function (req, res) {
res.send('ab*cd')
})
app.get('/ab(cd)?e', function (req, res) {
res.send('ab(cd)?e')
})
app.get(/a/, function (req, res) {
res.send('/a/')
})
app.get(/.*fly$/, function (req, res) {
res.send('/.*fly$/')
})