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
1 answer

error: json: unsupported type: func() time.Time in Golang

i am new in golang, just try some API in Echo Framework and got some error. My Models : package models import ( "net/http" "quotes/db" ) type Quote struct { Id int `json:"id"` Title string `json:"title"` …
1
vote
0 answers

Is there a way to assign result from rendering template echo framework

How I can assign result from rendering template to send this value as json, for ajax call my example: func Load(c echo.Context) error { params := map[string]any{ "btn_style": "btn-light btn-sm", } if err :=…
Unknown
  • 401
  • 4
  • 15
1
vote
1 answer

Partial update a structure with echo and gorm

I got a user interface, user model and user id structures type UserId struct { Id int64 `param:"id" json:"id"` } type User struct { Email string `json:"email"` Password string `json:"password"` Username string …
Faulheit
  • 116
  • 7
1
vote
2 answers

Go Echo: POST Method gives Error "Method not allowed"

Building an app with echo and basically created some routes. The GET ones are working fine, but the post one is give me the error: Do not really understand where the error lies here. {...."method":"GET","uri":"/addPerson", message=Method Not…
LogiBaer
  • 43
  • 3
1
vote
1 answer

Inject headers into httptest.Recorder so echo context can see them in Golang

I have some tests that inject headers into Echo like this: func test() { request := httptest.NewRequest(http.MethodGet, "/", http.NoBody) recorder := httptest.NewRecorder() recorder.HeaderMap.Add("If-None-Match",…
Woody1193
  • 7,252
  • 5
  • 40
  • 90
1
vote
2 answers

when using fmt.Printf() many blanks are displayed

I'm trying to complete an echo server using golang. server like this: // use tcp to echo time func main() { // listen tcp localhost:8000 listener, err := net.Listen("tcp", "localhost:8000") if err != nil { fmt.Fprintf(os.Stderr,…
1
vote
2 answers

Echo skip JWT middleware

I used golang jwt middleware. e.Use(middleware.JWTWithConfig(middleware.JWTConfig{ SigningKey: []byte(os.Getenv("Signing_Key")), TokenLookup: "header:x-auth-token", })) It waits token for all functions but I don't want to use this…
oakkose
  • 353
  • 3
  • 13
1
vote
0 answers

How to integrate pkg service/db connection to the util pkg validator?

what is the approach to get data(field name) from database within the validator.go? main.go package main import ( "v/utils" "os" "github.com/go-playground/validator/v10" ) func init() { env.Load(".env") } func main() { e :=…
Shawn Yeung
  • 99
  • 1
  • 6
1
vote
2 answers

CORS golang echo framework

I have next Go code: package main import ( "database/sql" "encoding/json" "fmt" "net/http" _ "github.com/go-sql-driver/mysql" "github.com/labstack/echo" "github.com/labstack/echo/middleware" ) func main() { // Echo instance e :=…
undernet
  • 57
  • 1
  • 8
1
vote
1 answer

golang echo controller model

I am getting the following error when trying to factory my controller: cannot use &(personController literal) (value of type *personController) as PersonController value in return statement: wrong type for method CreateNewPerson (have…
Ming
  • 1,349
  • 4
  • 13
  • 36
1
vote
1 answer

How to trigger BasicAuth prompt in conjunction with custom HTTP error handler in golang/echo?

Consider the following example which utilizes the basic auth middleware for a custom group and also uses a custom http error handler: package main import ( "net/http" "strconv" "github.com/labstack/echo" …
helpexchange
  • 21
  • 2
  • 7
1
vote
0 answers

What opens persistConn when running a Go server?

Overview I have a Go echo http server running with version 1.13. $ go version go version go1.13.7 linux/amd64 I'm monitoring a number of different statistics about the server, including the number of goroutines. I periodically see brief spikes of…
MirroredFate
  • 12,396
  • 14
  • 68
  • 100
1
vote
0 answers

Golang+Echo: Is there a good way to convert CRLF to LF for context.Bind in case multipart/form-data

I'm use github.com/labstack/echo framefork, and when I retrive data from FE in multipart/form-data, strings contains line breaks as CRLF, but it makes a problem with counting string length, because of CRLF counts as 2 symbols (using…
Demetrio
  • 11
  • 1
1
vote
0 answers

How to prevent the form binding of a perticular field in golang echo framework?

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

go-echo get POST body

I have an audit log middleware which trying to log details of each grpc function call. Currently I can get request method and url. But I'm not able to get the values in Post body. Also this middleware is use to log multiple functions which contains…
jason135
  • 179
  • 1
  • 3
  • 18