Questions tagged [go-fiber]

Fiber is an Express inspired web framework built on top of Fasthttp, the fastest HTTP engine for Go.

Fiber is an Express inspired web framework built on top of Fasthttp, the fastest HTTP engine for Go.

167 questions
2
votes
1 answer

How to return different structs from handler for success and error response

I have the following code in my main.go app.Post("/user", util.ValidateJson[model.User], func(c *fiber.Ctx) error { user := new(model.User) _ = c.BodyParser(&user) return c.Status(fiber.StatusCreated).JSON(model.Response{ Data: …
Kaigo
  • 1,267
  • 2
  • 14
  • 33
2
votes
1 answer

Golang Gorm Fiber - How can I send the name I defined as alias to my index template?

I'm trying to switch from PHP to GO, but I'm stuck at one point, I ask for your help. I just define an alias named "durums" in the query, there is no such named field in the database. how can I send the name I defined as alias to my index…
Ugur Tas
  • 216
  • 1
  • 9
2
votes
1 answer

Golang - Html Template : How do I create a Nav-item - Submenu? I couldn't find how to do it

I'm trying to switch from PHP to GO, but I'm stuck at one point, I ask for your help. I have a table called Menu in the database. Here, menuid equal to 0 becomes the main menu. Those not equal to 0 depend on the written menuid. I want to draw the…
Ugur Tas
  • 216
  • 1
  • 9
2
votes
1 answer

GORM [error] unsupported data type: &[], incorrect schema

GORM v1.25.1, I'm tryping to run DB.AutoMigrate() on Worker, Poster and Job models but running into [error] unsupported data type: &[]. The Worker and Job struct should have a many-to-many relation, while Poster and Job should have one-to-many…
2
votes
1 answer

How to test fiber params

I need to write a test for one of the handlers. Inside the handler I have somethings like: ctx.Params("id") Is it possible to create a context so that inside the handler Params are not nil? I tried to change the Params field using…
Komi Komi
  • 23
  • 3
2
votes
1 answer

Do I have to specify each endpoint in API Gateway when using GoFiber for my endpoints?

I'm using GoFiber via lambda for my API, and I don't really see the value in having to hard-code all of the values in the yaml file if I'm going to handle the routing directly in GoFiber. Is that a common use case? I want to use API Gateway to have…
Joel Hager
  • 2,990
  • 3
  • 15
  • 44
2
votes
1 answer

Implementing SSE in Go using Fiber and channels

I'm trying to implement Server Sent Events in Go. I'm using the Fiber framework, and found an example implementation that worked fine. But it does not uses channels, so I cannot send events/messages whenever I want, it just keeps sending them at a…
Mustaghees
  • 506
  • 6
  • 16
2
votes
1 answer

Why Fiber duplicate GET endpoint whith a HEAD endpoint

these is my api and i don't know what is the problem for that endpoints duplicated, i was trying if is something of config but there is not nothing about in their documentation package main import ( "aurora/routes" "fmt" …
2
votes
1 answer

How to apply new TLS configuration for HTTPS server in Go Fiber

I use Go Fiber for TLS server. How I can apply new configuration to TLS server without restart application? For example I have code app := fiber.New() m := &autocert.Manager{ Prompt: autocert.AcceptTOS, HostPolicy:…
Vyacheslav
  • 59
  • 5
2
votes
0 answers

How does Fiber handle concurrent requests?

I was wondering if Go would allocate a new goroutine per each request, like Java does with threads, or does it use an event-queue in the backend to perform tasks asynchronously, like node js (express)? Go Fiber is one of the fastest frameworks out…
Ashwin Prasad
  • 108
  • 1
  • 6
2
votes
1 answer

Find all in a list containing ForeignKey MySQL Gorm get null result

I am writing a function to process get all data from 2 linked tables, Order and OrderItem with foreign keys attached as the code below. But the result I get is OrderItem[ ] Null, even though I have Preload("OrderItems"). type Order struct { …
2
votes
0 answers

Websocket: Is it necessary to send ping messages by hand? (e.g between fiber websocket server & js client in browser)

I've wrtten a websocket server in fiber's websocket, and the client is js websocket in browser. Some questions regarding ping/pong: Is there any default ping/pong msg between the websocket server & client? If yes, then why I can't see it in…
Eric
  • 22,183
  • 20
  • 145
  • 196
2
votes
1 answer

Golang Fiber and Auth0

I'm new to golang, and have followed this (https://auth0.com/blog/authentication-in-golang/) auth0 guide, for setting up a go rest api. I'm struggeling with converting to Fiber, and in the same time putting my functions that are being called by…
Mathias
  • 43
  • 1
  • 6
2
votes
2 answers

How to set Routes Group in Go Fiber V2 from separated file?

I want to make seperate files for each sub main routes. I am using go 1.17 main.go package main import ( "rolling_glory_go/routes" "github.com/gofiber/fiber/v2" ) func main() { app := fiber.New() app.Get("/", func(c *fiber.Ctx)…
Gagantous
  • 432
  • 6
  • 29
  • 69
2
votes
0 answers

go-fiber BodyParser "converter not found for struct structName"

I'm trying to convert my current Rest API from Express.js to GO using fiber, so I am a bit new to golang, i want to parse nested JSON to nested structure in request body, I even tried the same example on github go-fiber example, but I'm getting the…
Abed Chouman
  • 61
  • 2
  • 5
1
2
3
11 12