Created
April 30, 2020 19:46
-
-
Save thanhdatvo/820a2ace4a3b18831a8968af23178735 to your computer and use it in GitHub Desktop.
Expressjs router params
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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