Skip to content

Using the NewCSSMiddleware with echo #708

Closed Answered by joerdav
dimmerz92 asked this question in Q&A
Discussion options

You must be logged in to vote

You should be able to leverage the echo.WrapMiddleware

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"))
}

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@dimmerz92
Comment options

@joerdav
Comment options

joerdav Apr 30, 2024
Collaborator

Answer selected by dimmerz92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants