Add new Routing feature to README

This commit is contained in:
Vic Shóstak 2020-06-19 13:12:05 +03:00 committed by GitHub
parent 308ab66eb6
commit dbdfdc5fbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

12
.github/README.md vendored
View File

@ -159,7 +159,19 @@ func main() {
fmt.Printf("Name: %s, Age: %s", c.Params("name"), c.Params("age"))
// => Name: john, Age:
})
// GET /plantae/prunus.persica
app.Get("/plantae/:genus.:species", func(c *fiber.Ctx) {
c.Params("genus") // => prunus
c.Params("species") // => persica
})
// GET /flights/LAX-SFO
app.Get("/flights/:from-:to", func(c *fiber.Ctx) {
c.Params("from") // => LAX
c.Params("to") // => SFO
})
// GET /api/register
app.Get("/api/*", func(c *fiber.Ctx) {
fmt.Printf("/api/%s", c.Params("*"))