Skip to content

Instantly share code, notes, and snippets.

@thanhdatvo
Created April 30, 2020 19:51
Show Gist options
  • Save thanhdatvo/88641b2e230029a983e15c3b93650560 to your computer and use it in GitHub Desktop.
Save thanhdatvo/88641b2e230029a983e15c3b93650560 to your computer and use it in GitHub Desktop.
Go Fiber 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", 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