Skip to content

Instantly share code, notes, and snippets.

@thanhdatvo
Created April 30, 2020 19:46
Show Gist options
  • Save thanhdatvo/820a2ace4a3b18831a8968af23178735 to your computer and use it in GitHub Desktop.
Save thanhdatvo/820a2ace4a3b18831a8968af23178735 to your computer and use it in GitHub Desktop.
Expressjs router params
/*
Route path: /users/:userId/books/:bookId
Request URL: http://localhost:3000/users/34/books/8989
req.params: { "userId": "34", "bookId": "8989" }
*/
app.get('/users/:userId/books/:bookId', function (req, res) {
res.send(req.params)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment