-
I am using echo as my server. Just wondering if anyone has successfully managed to use NewCSSMiddleware with echo, and how they may have done it? Otherwise, it's looking like I would need to define my own middleware that does the same thing. |
Beta Was this translation helpful? Give feedback.
Answered by
joerdav
Apr 30, 2024
Replies: 2 comments 2 replies
-
Pretty sure you're going to have to write your own middleware. Echo middleware uses Echo types. The templ middlware uses std lib http types. Shouldn't be hard to duplicate tho |
Beta Was this translation helpful? Give feedback.
0 replies
-
You should be able to leverage the If I convert our example in the docs: func main() {
// Echo instance
e := echo.New()
// Middleware
e.Use(middleware.Logger())
e.Use(middleware.Recover())
c1 := className()
e.Use(echo.WrapMiddleware(func(h http.Handler) http.Handler {
return NewCSSMiddleware(httpRoutes, c1)
}))
// Routes
e.GET("/", hello)
// Start server
e.Logger.Fatal(e.Start(":1323"))
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
dimmerz92
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should be able to leverage the
echo.WrapMiddleware
If I convert our example in the docs: