express router.post example
Example 1: express get url parameters
app.get('/path/:name', function(req, res) {
res.send("tagId is set to " + req.params.name);
});
Example 2: express route parameters
Route path: /users/:userId/books/:bookId
Request URL: http://localhost:3000/users/34/books/8989
req.params: { "userId": "34", "bookId": "8989" }
Example 3: 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$/')
})