Created
April 30, 2020 19:51
-
-
Save thanhdatvo/88641b2e230029a983e15c3b93650560 to your computer and use it in GitHub Desktop.
Go Fiber 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", func(c *fiber.Ctx) { | |
c.JSON(fiber.Map{ | |
"userId": c.Params("userId"), | |
"bookId": c.Params("bookId"), | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment