Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
@wsantos "Pre adds middleware to the chain which is run before router." " Use adds middleware to the chain which is run after router."
So I guess Pre middleware will run on every incoming connection, regardless of the URL path.
Waldecir Santos
Thanks @zvodd , I've another question, I've created a middleware that retrieves the user from db if he/she is logged in, but now, I'm not sure how to "automatically" expose it to the template, I really don't want to add it on every single c.Render any idea or options on how to do it ?
Hi, is it possible to get an error when binding JSON to the struct which containing for example int, but JSON will not contain specific key?
I found one method with using pointers on types but it's really not user friendly
William Méndez
Hi folks, has anyone used Buffalo / Pop ORM in their Echo project?
Hey guys, I'm having issues registering a handler http method that's non standard (webdav) so for example when registering server.Add("REPORT", handler) it won't be handled. According to the checkMethodNotAllowed() method, it will only search trough the ones listed here: https://github.com/labstack/echo/blob/master/router.go#L264 is there any way to extend this?
well, it appears that this is not possible, will have to fork the package
Tu Le
I am working on a feature related to user authorization. I need to take the HandlerFunc name in middleware for checking if the user has permission to request this API or not. So How can I get the HandlerFunc name in middleware?
Renatho Azevedo
Hi there, is there a way to use jwt middleware with gorilla websocket for authentication ?
Arun Gopalpuri
@lammel - or any echo framework moderator review my PR please? labstack/echo#1628

I created a struct to bind like this

type Something struct {
        UserID            string `form:"user"`
    TopicList         *[]uint  `form:"newTopic"`

in this moment, can i bind request like below?

POST /something HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded

A user has many topic and i want to set many topic list in my request and bind it to my struct. Thanks.
Is it possible to detect the filename of c.FormFile before accepting the entire file? I would like to reject an upload before the user has uploaded the entire file.
Gursharan singh
how can we prevent bind function to bind some form fields to the struct fields?

For example
type student struct{
ID int form:"-"
Name string form:"name"
Details string form:"details"

Here i do not want bind function in echo to bind id from the create student request to ID. but if i post like. -:1 name:student details:student

it will bind - value to ID which i do not want.

And if i skip form tag as shown below
type student struct{
ID int
Name string form:"name"
Details string form:"details"

then do a post request

id:1 name:student details:student

now the bind function will bind id with ID.

the problem is I am not able to skip binding for ID field

Arun Gopalpuri
How can i get http.Handler from echo context? I have to call a custom middleware and it requires http.Handler
Steve Mynott
Hi I'm trying to log the system version as part of startup and e.Logger.Info() doesn't seem to work until e.Start ? Do I need to write my own run once middleware?
Steve Mynott
hmm I think I see what's happening
Albert Wong
hi guys, does anybody know set proxy (middleware) timeout ?I cant find this param in ProxyConfig
Lulu Cheng
hello, is there any recommendation middleware to use redis caching w/ echo?
Bhuvanachandra G
Can somebody help me with this query?
https://echo.labstack.com/guide/context#extending-context, This guide don't work on echo/v4, I want some solutions.
Hi, there
Enver Bisevac
Hi, I think in CORS middleware configuration for AllowOrigins should accept regex, so it would be nice to have something like wildcard subdomain
Hi guys
I've been using the std lib and decided to try out echo
I'm trying to test the session module but keep getting the same "session" session not found
anyone else encountered this before and what could I be doing wrong
 e := echo.New()

 // and try to access it in handler like below
 func (h *Handler) loginUser(c echo.Context) error {
    sess, err := session.Get("session", c)
    if err != nil {
        return err
thanks in advance
hai! for some reason i'm having issues with echo.NotFoundHandler in v4
i'm almost certainly missing something obvious. sec
 echo.NotFoundHandler = func(c echo.Context) error {
   log.Debug("calling not found handler")
   return c.String(http.StatusNotFound, "found the not found handler!")
i neither see the debug log nor the string i'm attempting to return, just 404 page not found which i believe is just http.StatusNotFound stringified
does anyone use this? is there a possible bug here? have tried it before and after the definition of e := echo.New()
Carlos Revillo
hello, i'm new in golang and this framework. i have defined a route like e.GET("/users", GetUsers). No, in my handlers/users.go i have a method like func GetUsers(c echo.Context) error {
2 replies
How should i define the route and the GetUers method to pass a parameter? i would lilke to have something like `func GetUsers(c echo.Context, whatever *usersController) error {```. this userWhatever will have injected a service and this service will depend on the users repository. any example on how to acomplish that? otoh, maybe that's not a way to go?
I'm going to caches the response of the echo framework to the redis DB.
Is there anyone who can tell me how??
b, _ := json.Marshal(c.Response())
    err = client.Set(ctx, key, b, 0).Err()
I don't think this is the right way....
Vadim Yermolin

Hey guys. How can I actually bind a request with a nested object (in x-www-form-urlencoded format) like this?


I have a struct with a field called GeeTest which is a geetest.Request struct with corresponding string fields and form tags. But Echo bind seems to not parse this object completely...

Steve Mynott
anyone know how to disable tlsv1.0 & 1.1 before I dig deeper?
Does anyone know how to pass the response from a route to a gob encoder?
Steve Mynott
Well I managed it via
    tlsConfig := &tls.Config{MinVersion: tls.VersionTLS12, Certificates: []tls.Certificate{cert}}
    s := &http.Server{Addr: ":4443", TLSConfig: tlsConfig}

Hi, i'm using flutter as websocket client of a backend application using echo and golang. My client is able to connect to ws://echo.websocket.org without error, but if i connect to echo websocket, i get this error flutter: WebSocketChannelException: WebSocketChannelException: WebSocketException: Connection to '' was not upgraded to websocket I tired with websocket client browser based and i'm able to connect to echo ws server. So it seems that flutter is doing something different than others. I read a lot about this problem with flutter as websocket client, and it seems that actix-web got the same kind of problem here : actix/actix-web#567
With this comment interresting comment : fixed in master.

dart client sends "content-length" header in request, and that is the problem.

by any chance, echo could have this same kind of fix ?
hum, i used github.com/gorilla/websocket and now it works ! sorry for the noise :)