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
0
votes
0 answers

Problem using c.Sendfile(path) in fiber (golang web framework)

I have saved some of videos in specific paths. I want the video to be displayed when the API is called. I do this using c.SendFile(). The problem is that by calling the API once by vlc or browser, it is called several times. I realized this from…
0
votes
0 answers

issue while sharing a rabbitmq connection between goroutines with prefork true

I have a go-fiber app that tries to publish messages to RabbitMQ. And here is the simplified version of the app: // main.go type custom_handler struct { RMQConn *rabbitmq.Connection } func newHandler(conn *rabbitmq.Connection) custom_handler { …
Eziz Durdyyev
  • 1,110
  • 2
  • 16
  • 34
0
votes
2 answers

Golang Fiber template engine HTML: render: template does not exist

On my Ubuntu 22.10 digitalocean server, I'm experimenting with Golang and Fiber and the html template engine. Loving it so far. It all works, including the Mysql connection and sending email. Except for one thing. I keep getting the error render:…
Jeex
  • 127
  • 8
0
votes
2 answers

go - How to mock fiber context

I've been trying to mock a fiber.Ctx but I have not been able to make it work I have been getting this error: --- FAIL: TestCheckHeaders (0.00s) panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime…
Taha Khan
  • 69
  • 5
0
votes
1 answer

What is the meaning of variable only valid within handler

In go-fiber docs they say: As a rule of thumb, you must only use context values within the handler, and you must not keep any references is it OK if I passing around the context as a function argument like this: func GetList(c *fiber.Ctx) error { …
Bens
  • 831
  • 4
  • 12
  • 28
0
votes
0 answers

go postgres prepare statement error - panic: runtime error: invalid memory address or nil pointer dereference

I am working on a go restapi with fiber, but I hit a snag with an error I am not sure how to debug. The error seems to be coming from the prepare statement I am using to insert data into the database. panic: runtime error: invalid memory address or…
David Essien
  • 1,463
  • 4
  • 22
  • 36
0
votes
1 answer

How to change which IP address a go-fiber client is using?

I'm using Fiber as an HTTP client to make some requests to an http server, however I'm being rate limited. On my vm I configured 5 different IP addresses (public/private) and have confirmed that they are indeed connected to the internet. curl…
Benjamin Kosten
  • 361
  • 2
  • 12
0
votes
1 answer

Handling hCaptcha in golang

While integrating hCaptcha into my golang (go-fiber) project I followed this process: hCaptcha Demo
Eziz Durdyyev
  • 1,110
  • 2
  • 16
  • 34
0
votes
1 answer

Go Fiber not able to parse body in unit test

I am officially crying uncle to the benevolent samaritans of Stack Overflow. I am trying to unit test my GORM (Postgres) + Fiber API using a mock DB. I have a Card model and a CreateCardReqBody model for the POST request body. To setup the test, I…
0
votes
1 answer

How to get fiber.Ctx inside Gorm's AfterCreate() hook

I need to call some methods of fiber context like MultipartForm() and SaveFile() inside Gorm's AfterCreate() hook, how to do that?
Bens
  • 831
  • 4
  • 12
  • 28
0
votes
0 answers

How do I create variables within a Pongo2 template?

TL;DR I need a way to set variables from within Pongo2 templates, not passing them in from my controller code to be usable in the global template scope (i.e. not in a with block). I have just started learning Go and chose Fiber as my framework since…
Paul Norman
  • 1,621
  • 1
  • 9
  • 20
0
votes
1 answer

How to iterate over query params in Golang

I am using Fiber package in Golang to handle the httprequests and want to find all the query params present in request GET http://example.com/shoes?order=desc&brand=nike&lang=english I want to iterate over query params and looking for something…
0
votes
0 answers

Golang Gofiber BodyParser receive Unstructured JSON Array in REST Post API

I have a REST API that sends me the following body { "location": [ { "activity": { "confidence": 100, "type": "unknown" }, "battery": { "is_charging": false, "level": -1 }, …
Kingsley Simon
  • 2,090
  • 5
  • 38
  • 84
0
votes
0 answers

Actix - How can I build a Web server to serve whole html files from gatsby deploy? not just 1 html file

First of all I have tried to click on index.html that served from Actix, it is very fast ever. ... I implement Web Server by GoFiber to serve static files, I use the following code: package main import ( "log" …
sirisakc
  • 892
  • 2
  • 15
  • 30
0
votes
0 answers

Directory index is forbidden golang fiber framework

c.SendFile Not Working Showing on postman that Directory index is forbidden func GetFile(c *fiber.Ctx) error { url := c.Params("file") return c.SendFile(fmt.Sprintf("./files/%s", url)) } func DownloadFile(c *fiber.Ctx) error { url :=…
Akik jamil
  • 25
  • 1