[Bug]: Middleware must be applied first or won't be called
Closed this issue · 0 comments
0SkillAllLuck commented
Description
If middleware is not registered first it won't be called.
How to Reproduce
- Create a new mojito project
- Register middleware after registering routes
- Middleware will not be called
Expected Behavior
Middleware can be applied at any point in time before ListenAndServe is called
Version
v0.0.14
Code Snippet
package main
import "github.com/go-mojito/mojito"
func main() {
mojito.GET("/", func(ctx mojito.Context) {
ctx.String("Hello World")
})
mojito.WithMiddleware(middleware.Logging)
mojito.ListenAndServe(":8123")
}
Checklist:
- I agree to follow Mojito's Code of Conduct.
- I have checked for existing issues that describe my problem prior to opening this one.
- I understand that improperly formatted bug reports may be closed without explanation.