152 questions
1
vote
1
answer
72
views
Accessing postgres db using pgxpool in a goroutine
I have created a function to return the db connection of a postgresdb using pgxpool. But I don't want to create multiple pools since i will be calling this function each time to execute a query.
Since ...
1
vote
2
answers
99
views
Echo Golang render content and change url path without reloading layout page
I am trying to build a SPA.
There are some requirements I am desperately trying to achieve.
I have an index.html file as a layout which has some templates defined. The rendering of that works as ...
1
vote
1
answer
101
views
How does .Static function works in Echo for Go
I have been dealing with an issue with the static files in the application I'm building in go using Echo framework, I can not get the files to load, I only get 404 for the static files.
I have this in ...
1
vote
0
answers
107
views
Echo response issue with Templ ( Golang )
Echo & Templ Response Issue
I am trying to build an admin dashboard for my project using Echo V5 & Templ.
My current setup
// RegisterRoutes -> a route registeration method used to ...
1
vote
0
answers
347
views
How to use templ in conjunction with the Echo framework?
I'm planning use templ library like this github.com/a-h/templ v0.2.707
but there is problem where rendering html
first will show you my code written so far:
go.mod
module cozy
go 1.21.6
require (
...
1
vote
2
answers
934
views
Issues with JWT Middleware in Echo and oapi-codegen Application Causing Multiple 401 Responses
I'm working on an Echo-based Go application where I'm using JWT for authentication. I've integrated the echo-jwt middleware and oapi-codegen for OpenAPI validation. However, I'm facing issues where ...
2
votes
0
answers
897
views
Use a custom logger, with go echo framework
i am trying to apply a format to my loggin, with request specific details in the format. EX: when i log "Test log" I should expected to be logged like:
2024-06-22T19:36:48+01:00 INFO [...
2
votes
0
answers
116
views
Byte array transfer through echo framework to JS blob
I'm trying to pass the result of a google text to speech api SynthesizeSpeech.audio_content to frontend throught echo framework (golang).
resp, err := client.SynthesizeSpeech(c.ctx, &req)
if err !=...
1
vote
0
answers
598
views
Problems with static files Go-Echo-Templ
I am starting a Go project using Echo and Templ.
I have a project structure as follows:
/
/cmd
main.go
/static
css
style.css
/view
/layout
base.templ
The problem I am ...
1
vote
0
answers
803
views
Go labstack/echo and OpenTelemetry doesn't work
I'm trying to add otel tracing to my Echo server. I'm basing my code on example but anything is not coming from application to Jaeger instance that i'm running locally.
First, I've injected the ...
3
votes
0
answers
1k
views
How to Ensure Required Fields Presence and Validate HTTP Request with Echo Framework?
Is there a anyway to validate if a field is present in a http request with the echo framwork?
Lets take this code for example:
type ExampleStruct struct {
Name string `json:"name"`
...
1
vote
1
answer
848
views
Go framework Echo middleware usage
In my main function I have used the go framework echo to create a Logger and Recover
func main() {
db := initDB("storage.db")
migrate(db)
e := echo.New()
-> e.Use(...
-2
votes
1
answer
617
views
echo: http: panic serving [::1]:45724: runtime error: invalid memory address or nil pointer dereference goroutine 10 [running]:
im trying to create an rest api with go/echo and postgres with raw sql but i cant make it work, no idea whats the problem
the console prints the text in the title
recipe.go
func CreateRecipe(recipe *...
1
vote
1
answer
294
views
How to pass param from middleware to controller
I am building a web API with Echo Labstack framework. I have a middleware in my route to check for user authentication, but then I am having difficulty in passing the data to controller and could not ...
2
votes
1
answer
41
views
Form variables not available in testing
I am a Go newbie. I have written an API server built on the Echo server, using the DeepMap OpenAPI generator and Postgres using pgxpool. It is working well enough and has been in use for a year, but ...