Closed wavemoroc001 closed 2 years ago
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
package main
import (
"log"
"github.com/gofiber/fiber/v2"
)
func handlePassQuery(c *fiber.Ctx) error {
param := c.Query("test", "Noting Here")
return c.Status(fiber.StatusOK).JSON(fiber.Map{
"Message": param,
})
}
func main() {
app := fiber.New()
v1 := app.Group("classroom-service")
account := v1.Group("/account")
account.Get("/submit-otp-link", handlePassQuery)
log.Fatal(app.Listen(":8585"))
}
@wavemoroc001 i cannot reproduce ? can't find "strconv.ParseUint" anywhere in our code, so must be the processes you didn't specify in the example
@ReneWerner87 Thank you for you kindness
I found root cause, I think that might match route to getAccountByID that i use strconv
before go to submit-otp-link
route
To fix that, Should I declare route submit-otp-link
before GetAccountByID
or Any better solution to prevent fiber route to wrong endpoint ?
account.Get("/:ID", h.GetAccountByID)
account.Get("/submit-otp-link", h.handlePassQuery)
https://docs.gofiber.io/guide/routing
yes please swap the route with the variable part with the route with the fixed part, otherwise the variable part will always be used before the other route, because with us the order plays a role just like with express
Thank you so much !
Question Description
Hi there, I try to pass query params in nested url prefix like this
http://localhost:8585/classroom-service/account/submit-otp-link?test=testMessage
Router
Handler
But it throw this Response
Cloud you advice how to fix this errors ?
Fiber version :
2.36.0
Code Snippet (optional)
No response
Checklist: