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

Golang Echo Labstack How to Call a Function / Method in a Template View

I am building a front end website with Golang Echo Labstack framework, and I want to call some custom functions in my template view. How do I do this with Echo? For example, I am able to do this with Gin func main() { r := gin.Default() …
Charas
  • 1,753
  • 4
  • 21
  • 53
2
votes
1 answer

Golang - Binding Headers in echo api

Golang - Binding Headers in echo api I'm trying to bind headers to struct. So far I did the same as in documentation here but it looks like doesn't work at all. I checked in debugger incoming request and it has proper header name and value but echo…
mikolaj semeniuk
  • 2,030
  • 15
  • 31
2
votes
0 answers

Map error to HTTP status code in Labstack Echo

When overriding HTTPErrorHandler, I observe that status code 200 is sent to the user even if I set the response status to a different value: package main import ( "github.com/labstack/echo/v4" "net/http" ) type MyError struct{} func (m…
user2233706
  • 6,148
  • 5
  • 44
  • 86
2
votes
1 answer

How to save log message to file (labstack/echo)

I need help.. I am using golang, and currently I want to save my log into logger file. I used echo framework for logging, like this: e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{ Format: "method=${method}, uri=${uri},…
TeaCup
  • 31
  • 2
2
votes
2 answers

How do I bind a date string to a struct?

type TestModel struct { Date time.Time `json:"date" form:"date" gorm:"index"` gorm.Model } i'm using echo framwork, and I have a struct like the one above, and I get string data like '2021-09-27' , how can I bind it to the struct? func…
Choi yun seok
  • 309
  • 2
  • 15
2
votes
1 answer

echo framework, downgrade privileges at which moment?

I use echo framework for creation of my API server. It is started by systemd and needs root by default, in order to aquire ports below 1024. For security I like to downgrade privileges of my go program after the listening port has been aquired by…
Volker
  • 428
  • 4
  • 15
2
votes
1 answer

Best way to implement timeout for specific route on Echo/Go

I wondered for the best method to set a timeout for the specific route on the Echo library. I implemented timeout with context.WithTimeout, but used several functions to encapsulate the context, and I think that was wrong. ctx, cancel :=…
Reza Mousavi
  • 4,420
  • 5
  • 31
  • 48
2
votes
1 answer

Swagger generation is ignoring SecurityDefiniton

Cannot understand one thing, why swag init command is generating everything, except SecurityDefinition block For example, this is my code on main function: // @title Swagger API // @version 1.0 // @description This is a documentation for PlatOps…
2
votes
2 answers

cannot get request header

I tried to print the request header using the echo framework, but it seems the echo framework does not load the header into the context.request.Header fields. Is this a bug for the echo framework? Here is the main function, and context.Request() is…
Canshi Wei
  • 55
  • 1
  • 5
2
votes
2 answers

Problem installing SSL Certificade in Go Lang with Echo framework (Client sent an HTTP request to an HTTPS server.)

I have build a Go server using Echo framework, i get TLS certificades and a domain name, but when i try a request i get the message "Client sent an HTTP request to an HTTPS server." and when i try acces the server from the IP address of the EC2…
Jorge Barraza Z
  • 171
  • 3
  • 9
2
votes
1 answer

How do I pass extra arguments to an Echo mux handler?

How do I pass along some extra variables to an Echo mux handler? I have registered a route like this in main.go: e.GET("/search/:query", handlers.Search(*kindex, app.infoLog)) As you might see this is not the correct signature for the handler. It…
martins
  • 9,669
  • 11
  • 57
  • 85
2
votes
1 answer

Echo web framework binding FormFile

I am using the Echo framework for a post endpoint that accepts the form data. I am using a Struct as a binding model to extract the form data. my binding model and upload handler code looks like below. type FormModel struct { ID string …
dev0864
  • 465
  • 2
  • 7
  • 17
2
votes
0 answers

HTTP Wrapper GOLANG and ECHO FRAMEWORK

I am confused in handling HTTP request as wrapper using GOLANG and ECHO FRAMEWORK to build as API service. Firstly, I have a communication between client and server like below: This communication is very easy. Secondly, Step 1: I want to use…
ThanhLam112358
  • 878
  • 1
  • 20
  • 51
2
votes
2 answers

What is the idiomatic way of getting an integer value from query string in Echo?

I have an integer query param "page", that defaults to 1. I can get it from Echo context like this: var page int pageString := c.QueryParam("page") if pageString == "" { page = 1 } else { var err error page, err =…
Fluffy
  • 27,504
  • 41
  • 151
  • 234
2
votes
1 answer

Golang echo package middleware implementation

I'm learning Go and was going through this example : echo middleware example. I wanted to do a deep dive to understand what was going on when we call next(c) in the function middleware function Process(). Looking at the main() I understand we…
hhprogram
  • 2,809
  • 3
  • 13
  • 25
1 2
3
9 10