Skip to content

Using http.handler as an handler #2395

Answered by aldas
gaurishhs asked this question in Q&A
Discussion options

You must be logged in to vote

There is echo.WrapHandler that you can use to wrap http.Handler into handler

echo/echo.go

Lines 888 to 894 in 82a964c

// WrapHandler wraps `http.Handler` into `echo.HandlerFunc`.
func WrapHandler(h http.Handler) HandlerFunc {
return func(c Context) error {
h.ServeHTTP(c.Response(), c.Request())
return nil
}
}

Here is example with it: https://echo.labstack.com/cookbook/embed-resources/

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by lammel
Comment options

You must be logged in to vote
4 replies
@aldas
Comment options

@gaurishhs
Comment options

@aldas
Comment options

@gaurishhs
Comment options

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