mirror of
https://github.com/gofiber/fiber.git
synced 2025-05-31 11:52:41 +00:00
Add new Routing feature to README
This commit is contained in:
parent
308ab66eb6
commit
dbdfdc5fbe
12
.github/README.md
vendored
12
.github/README.md
vendored
@ -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("*"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user