-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🤔 Routing example in readme does not work? #411
Comments
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
Hi @panda8z, thank you for opening your first issue here! This is expected behaviour because it will stop at the first match func main() {
app := fiber.New()
app.Get("/:name/:age?", func(c *fiber.Ctx) {
fmt.Printf("First route: [name]: %s [age]: %s\n", c.Params("name"), c.Params("age"))
c.Next() // Continue the stack
})
app.Get("/api/*", func(c *fiber.Ctx) {
fmt.Printf("Last route: [*]: %s\n", c.Params("*"))
})
app.Listen(3000)
// GET /api/register
// First route: [name]: api [age]: register
// Last route: [*]: register
} Maybe the example is unclear, and we should edit it :-) |
@Fenny And I found another error in Static Example I think here should be reletive path, but every It should be below: func main() {
app := fiber.New()
app.Static("/", "./public")
// => http://localhost:3000/js/script.js
// => http://localhost:3000/css/style.css
app.Static("/prefix", "./public")
// => http://localhost:3000/prefix/js/script.js
// => http://localhost:3000/prefix/css/style.css
app.Static("*", "./public/index.html")
// => http://localhost:3000/any/path/shows/index/html
app.Listen(3000)
} |
Nice catch, fixed this in 8303ce8 ~ https://github.com/gofiber/fiber/releases/tag/v1.10.0 |
Issue description
The text was updated successfully, but these errors were encountered: