Questions tagged [go-echo]

Echo is a high performance, extensible, minimalist Go web framework. This tag should be used with general questions concerning the Echo framework or any related middleware,

The Echo web framework by LabStack is designed to be minimalist yet high performing.

You can get started by looking at:

144 questions
0
votes
1 answer

Why is the header value not being read?

package middleware import ( "fmt" "github.com/labstack/echo/v4" ) type _getData struct { Token string `header:"Authorization"` } func TokenCheck(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { a :=…
Choi yun seok
  • 309
  • 2
  • 15
0
votes
2 answers

How to convert json to string in golang and echo framework?

I have a json that I receive by post {"endpoint": "assistance"} I receive this like this json_map: = make (map[string]interface{}) Now I need to assign it to a variable as a string but I don't know how to do it. endpoint: = c.String (json_map…
0
votes
0 answers

How to pass objects around middleware(s) and handler in go echo?

I am using echo to build a web server in go. What is the best way to pass objects around middlewares and a handler apart from using context.Set method? For example, let's consider the following case: func mw(next echo.HandlerFunc) echo.HandlerFunc…
kernel0707
  • 314
  • 2
  • 11
0
votes
1 answer

Is there a way to use the new go embed feature with echo?

Is there a way to use the new go embed feature with echo? I would like to serve files with the echo static middleware from files embedded with go embed. https://tip.golang.org/pkg/embed/ https://echo.labstack.com/guide/static-files
Ahmed
  • 367
  • 2
  • 12
0
votes
1 answer

I get an error that I don't know for what reason. a file disappears when I run the program

I'm coding in Go, and I created a file handler and a program that prints the value of that file. However, the file that should be created with file.Filename is deleted when I run it. I don't know what the reason is, even if I try to debug, the…
cdh88
  • 3
  • 4
0
votes
1 answer

Create unit test for WS in golang using Echo router

I use gorilla/websocket for ws and labstack/echo as router. I need to create unit test for the handler. I find topic with solving this problem with default go router, but i don't understand how to use it with echo. I have this: func TestWS(t…
godvlpr
  • 141
  • 1
  • 3
  • 11
0
votes
0 answers

How to use Labstack Echo ReverseProxy ModifyResponse using streams

Labstack Echo v4 has recently been updated to include ModifyResponse hook (ala golang's httputil ReverseProxy). Most of the examples of using this seem to leverage ioutil.ReadAll(). For example: func UpdateResponse(r *http.Response) error { b, _…
user3072517
  • 513
  • 1
  • 7
  • 21
0
votes
1 answer

Integration of Echo web framework with existing Gorilla Mux API

I am wanting to move to the echo framework for my API due to an openapi package we wish to use (opai-codegen) However our current API is built via gorilla mux. Due to the size of the current codebase we need to run them both side by side. So I am…
utx0_
  • 1,364
  • 14
  • 24
0
votes
0 answers

How to maintain information in a model state till user clicks submit and save to DB

I have a UI where the user enters some information and upload files/ delete files and modify information in multiple steps. I want to store the information in an object model in Go and only send it to DB once the user clicks on the submit at the…
dev0864
  • 465
  • 2
  • 7
  • 17
0
votes
1 answer

How to detect the goroutine that occupies the lock?

I made a HTTP server with Echo and store data use storm and data model like this: project1(bucket)  device_type_1(bucket)   device_1(kv)   device_2(kv)  device_type_2(bucket)   device_1(kv)   device_2(kv) project2(bucket)  ... In addition to…
navono
  • 152
  • 1
  • 8
0
votes
1 answer

Echo CORS w/ Proxy middlewares causes problems w/ Access-Allow-Origins response header

I'm using LabStack's Golang Echo Framework to build out a service. One of the routes, needs to proxy requests and responses to and from a backend service. But I also need CORS to work on this service as well. So I'm using middleware.CORSWithConfig…
RavenHursT
  • 2,336
  • 1
  • 25
  • 46
0
votes
3 answers

How omit struct filed

How can I omit struct filed, in my case I login user and return response with user data and token but in this case I need to remove password field, how can I do this ? type LoginFormData struct { Login string `json:"name"` Password string…
Vitaliy
  • 21
  • 2
0
votes
1 answer

avoiding global variables in routes for labstack/echo

I am using the labstack/echo webserver and gofight for unit testing. In learning go would like to know if there is a go idiom for accessing state outside of the (embedded) echo structure. For example: type WebPlusDB struct { web *echo.Echo …
Bruce Adams
  • 4,953
  • 4
  • 48
  • 111
0
votes
0 answers

go server out of memory when running as systemd service

I have created a webserver using the Echo router. It act as a REST endpoint. I tried to deploy it in an Ubuntu server using systemd. The requests are getting out of memory when I try to run it as a service. However it is working fine when I run it…
M14
  • 1,780
  • 2
  • 14
  • 31
0
votes
0 answers

Exporting pgsql query as CSV []byte encoded

I'm using the Echo web framework. One of the requests I need it to handle is to query an pgsql and return the data in CSV format. https://echo.labstack.com/guide/response I believe it would be something like: func(c echo.Context) (err error) { …
O. San
  • 1,107
  • 3
  • 11
  • 25