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
1
vote
0 answers

using Golang context.WithValue in testing for http request

I am trying to do unit testing, I am using GraphQL gqlgen for this case with Echo, I have been struggle to do test with my context, I can't add header in my testing due the GraphQL not using the server endpoint here is my code to set the context…
Weq Iou
  • 233
  • 4
  • 13
1
vote
3 answers

Bind request method POST

I have a problem with binding my request, because there are a lot of parameters, so I used struct containing param. package api import ( "github.com/labstack/echo/v4" "net/http" "trains-api/domain/models" …
Doctor Strange
  • 37
  • 1
  • 2
  • 10
1
vote
0 answers

Server not responding to the API call in go echo framework

Summary Hello i am facing very strange behaviour from GO Echo API call from client side, it sometimes stop providing output from the API call which happens randomly , i can see log registered via logger in request but it keeps awaited . below is my…
1
vote
0 answers

How to pass a map as query parameter

I'm using labstack Echo (v4.1.11) go framework to create a REST API. How do we/can we pass map query param in the URL? I tried adding the following struct for the request body PaginationRequest struct { Page int64 `query:"page"` …
Andy
  • 449
  • 5
  • 13
1
vote
3 answers

How to import sub-routes from other packages

Instead of writing every route under main(), like func main() { e := echo.New() e.GET("/api", sayHello) e.GET("/api/music", getMusic) e.GET("/api/user/:id", getDetail) e.POST("/api/user", addUser) // ... } How can I import…
Valorad
  • 726
  • 1
  • 10
  • 20
1
vote
1 answer

Gorm Count On Preloaded Field

I am using Postgres with Go Lang & the Echo framework as my base, with that I am using Gorm to build my database queries. So Here is my Profile Model, type Profile struct { gorm.Model InvoiceCount uint `gorm:"-"` CompanyName …
C0ol_Cod3r
  • 909
  • 2
  • 15
  • 35
1
vote
2 answers

Request body date parsing issue

I have a strange issue. I'm using echo package for routing. While I'm decoding json to struct I'm getting error parsing time \"\"2019-01-02\"\" as \"\"2006-01-02T15:04:05Z07:00\"\": cannot parse \"\"\" as \"T\"" my structs VendorAgreement struct { …
M14
  • 1,780
  • 2
  • 14
  • 31
1
vote
1 answer

Golang echo middleware redirect with empty page

I testing a redirect about echo when I just use the method to redirect it can show the login.html page successfully, but if I use a middleware test, it always shows empty page of login.html, what am I missing? e.Group("*.html", func(next…
smark
  • 43
  • 1
  • 8
1
vote
1 answer

Echo sessions middleware not saving

I am trying to use the sessions middleware for the echo web framework. The middleware is essentially just a wrapper around gorilla/sessions tailored to work with echo. I have basically just copied the example given in the documentation and extended…
Increasingly Idiotic
  • 5,700
  • 5
  • 35
  • 73
1
vote
0 answers

Why the last sentence of append,isn't shown at web?

Actually my last sentence of database(mysql table) after append does not show in web which I create with Echo framework. I have question on line 39: Comment item doesn't scan and show on local host:1324. package main import ( …
katy
  • 11
  • 1
1
vote
2 answers

How to use custom error settings for JWT middleware

I have followed the cook books guide to the letter, found here https://echo.labstack.com/cookbook/jwt But when using the JWT middleware I am having some issues with adding custom error messages. Login works fine, even to the point of not giving…
C0ol_Cod3r
  • 909
  • 2
  • 15
  • 35
1
vote
2 answers

How to properly test handler with custom context in echo?

I use echo framework with Custom Context: ApiContext struct { echo.Context UserID int64 UserRole string } my middleware: e.Use(func(h echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { cc :=…
happy_yar
  • 61
  • 1
  • 4
1
vote
1 answer

Echo is not clearing the session

I am using Echo for my web application. I tried to implement Login and Logout. When I tried to logout, its not clearing the session. Here is my code: func Logout(c echo.Context) error { sess, _ := session.Get("session", c) sess.Options =…
pyprism
  • 2,928
  • 10
  • 46
  • 85
1
vote
1 answer

Close all goroutines when HTTP request is cancelled

I am making a web crawler. I'm passing the url through a crawler function and parsing it to get all the links in the anchor tag, then I am invoking same crawler function for all those urls using seperate goroutine for every url. But if if send a…
heartofrevel
  • 181
  • 1
  • 3
  • 12
1
vote
1 answer

How to return valid jsonapi response using google/jsonapi and echo framework

The code bellow return a two concated JSON strings and a wrong content-type text/plain. Should be application/vnd.api+json package main import ( "github.com/google/jsonapi" "github.com/labstack/echo" "net/http" ) type Album struct { …
michaelbn
  • 7,393
  • 3
  • 33
  • 46