Params
Method can be used to get the route parameters, you could pass an optional default value that will be returned if the param key does not exist.
Defaults to empty string (""
), if the param doesn’t exist.
c.Params(param string, defaultValue ...string) string
// GET http://example.com/user/fenny
app.Get("/user/:name", func(c *fiber.Ctx) {
c.Params("name") // "fenny"
c.Params("age", "21") // "21"
})
Returned value is only valid within the handler. Do not store any references.
Make copies or use theImmutable
setting instead. Read more…__