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
18
votes
5 answers

extract JSON from golang's echo request

I'm using Echo to build a minimalist server in Golang. In, Echo one can bind an incoming JSON request payload to a struct internally and access the payload. However I have a scenario wherein I know only 3 fields of the incoming JSON request…
7hacker
  • 1,928
  • 3
  • 19
  • 32
8
votes
3 answers

How to use logging middleware

Here below is the entry point of my web application written in Go using Labstack's Echo: package main import ( "github.com/labstack/echo" mw "github.com/labstack/echo/middleware" ) func main() { controller :=…
j3d
  • 9,492
  • 22
  • 88
  • 172
7
votes
4 answers

How to fix refreshing error with Echo and Angular

I'm setting up a web server with Go (using Echo) as the backend and Angular 6 as the frontend. What I do is make a simple app using Angular-cli 'ng new my-app', add a helloworld component and a '/helloworld' route and then build it into production…
6
votes
1 answer

unit testing GraphQL in Golang

in this case I am using Echo mongo-driver (MongoDB) gqlgen graphql type safe is there any simple example for testing my Mutation and Query ? I do love to get advices for this. I have tried to find but can't found any so far, thank you :)
Weq Iou
  • 233
  • 4
  • 13
6
votes
3 answers

How to add JWT auth to swagger (go + echo + swaggo/swag)

I am using swaggo (https://github.com/swaggo/swag) to auto-create a working swagger specification for my API. The swagger spec allows me to run all of my API endpoints and receive responses. I then added JWT authentication to all of my endpoints. …
Swoop
  • 514
  • 5
  • 17
5
votes
1 answer

How to works with Golang echo framework and Telegram bot?

I want to use "telegram bot" with "echo framework" (When the server started, echo and telegram bot work together). I used the below code, but when I ran that, the telegram bot didn't start. My main.go: package main import ( "database/sql" …
MohammadReza
  • 427
  • 4
  • 16
5
votes
1 answer

Testing POST request with Echo (expected vs actual output)

I'm kinda new in Go, so, sorry if this is a silly question. I have been recently trying some API with Echo. I'm trying to test a route(POST) handler of Go echo that gets a json and puts it in an array. Bellow is the code for the handler main.go and…
GaidarOS
  • 73
  • 1
  • 7
5
votes
1 answer

Assignment to entry in nil map when using http header with Echo golang

here is my test using testing package and echo web http framework : (webserver variable is a global echo instance) func TestRunFunction(t *testing.T){ req := new(http.Request) **req.Header.Set("Authorization","Bearer "+loginToken.Token)** …
Chenko47
  • 293
  • 5
  • 10
4
votes
1 answer

Echo Groups not working with OpenAPI generated code using oapi-codegen

I am using oapi-codegen to generate my server code and Echo Labstack as the server. When I pass a Group instance to Openapi.RegisterHandlers instead of an Echo instance, I always get a 400 error with {"message":"no matching operation was found"} for…
user2233706
  • 6,148
  • 5
  • 44
  • 86
4
votes
4 answers

Can't seem to get started with Go and Echo

Trying to build a simple crud api with Golang and Echo and I can't get past the first tep in the Echo docs. I run go get -u github.com/labstack/echo/... then I create server.go: package main import ( "net/http" …
user2799827
  • 1,077
  • 3
  • 18
  • 54
4
votes
1 answer

How to deploy GO Echo my app to Elastic Beanstalk

I am trying to deploy a Go echo app to elastic beanstalk. I am using go modules and go.mod and go.sum are checked into my repo I have the following files in the root of my repo also Buildfile build: go build -o bin/application…
Damien
  • 4,081
  • 12
  • 75
  • 126
4
votes
2 answers

Creating unique Indexes with MongoDb default driver in Go

I'm having some issues creating unique indexes for some of my data using the official MongoDB driver for Go. So I have a struct like this: type Product struct { ID primitive.ObjectID `json:"_id" bson:"_id"` Name string …
imadu
  • 69
  • 2
  • 6
4
votes
1 answer

Testing a multipart form upload endpoint in Echo framework

I'm using labstack's Echo framework for building APIs in Golang. Now I have a problem that I can't seem to get around when I want to test an endpoint. I have a handler function like this func DoStuff(c echo.Context) error { businessUnit :=…
jcobhams
  • 796
  • 2
  • 12
  • 29
4
votes
1 answer

Passing parameters to Echo route middleware

How to pass a parameter to middleware in Echo? There is an example of what I want to achieve. func (h *handlers) Check(pm string, next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { if pm == "test" { …
Hossein
  • 115
  • 1
  • 11
4
votes
3 answers

How to get sum of salary column from table GORM

I am using PostgreSQL and golang to write a backend. I am having a problem to get a sum of salary column. This is my code: func GetSalarySum(c echo.Context) error { db, err := gorm.Open("postgres", "host=localhost port=5433 user=postgres…
gauravsbagul
  • 79
  • 1
  • 2
  • 8
1
2 3
9 10