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

convert rest api POST request from json to form-data in golang gofiber framework

I have the following code that works for JSON in the body of the POST request but i now want to convert this to using form-data in the body of the request Here is what i have func Signin(c *fiber.Ctx) error { var data map[string]string if…
uberrebu
  • 3,597
  • 9
  • 38
  • 73
2
votes
1 answer

golang gofiber framework demo in k8s with Datadog APM integration --how to add tracer and profiler?

I have a small proof-of-concept project to add DataDog APM/tracing capabilities to a gofiber (https://github.com/gofiber) web app. The app is up and running in an EKS environment which already has strong DataDog integration (agent, APM enabled for…
Robert Campbell
  • 303
  • 3
  • 12
2
votes
1 answer

How to extract values from local context in gofiber

I have managed to use the local context to set database query results using a custom middleware. I am trying to see how I can authenticate a user then pull their details from the database and inject it to the context. This has been done. The local…
Barty
  • 164
  • 3
  • 10
2
votes
1 answer

Race(?) with Mutex - corrupt data in map

In a project I want to use a cache to store things like a hash. However, it happens from time to time that the stored value in the cache changes to the key. Usually around 4 characters from the key are taken over: <- Set hash::helloworldtest =…
Daniel
  • 1,426
  • 1
  • 11
  • 24
2
votes
2 answers

Update method does not update zero value

Original Question When using the Update method in GORM the new data does not get saved. i.e. I want to set a bool from true to false, but it stays true even after the Update method. In the description of the method there is a warning: "WARNING when…
Heikkisorsa
  • 740
  • 9
  • 31
1
vote
1 answer

For WebSockets client to Golang Fiber, how do you morph an HTTP client / connection into a WebSocket?

For background, see this recent stackoverflow article. I am using Golang Fiber to set up a WebSockets service like this: app.Use("/ws", handler.UpgradeHandler) app.Get("/ws/:id", websocket.New(func(ws *websocket.Conn) { …
Kode Charlie
  • 1,297
  • 16
  • 32
1
vote
1 answer

What triggers GET handler for websockets connection in Go / Fiber?

For WebSockets support in Golang, many examples feature Fiber servers with endpoints like this: app.Use("/ws", func(c *fiber.Ctx) error { // IsWebSocketUpgrade returns true if the client // requested upgrade to the WebSocket…
Kode Charlie
  • 1,297
  • 16
  • 32
1
vote
1 answer

How to do a query in golang, fiber, using database/sql and "github.com/lib/pq" as the postgresql driver

This is my controller in fiber func Register(c *fiber.Ctx) error { user := new(User) if err := c.BodyParser(user); err != nil { return c.Status(400).JSON(fiber.Map{ "error": err.Error(), }) } if…
poo
  • 27
  • 3
1
vote
1 answer

Reusing model and removing fields from the response in Fiber/MongoDB

I'm trying not to create a wall of code and not re-declare code if not needed. My two major issues right now are: In line 47 there's overwriting/decoding on an existing user model userCollection.FindOne(ctx, filter, opts).Decode(&user) but it's not…
shimmy
  • 31
  • 3
1
vote
1 answer

Golang Fiber Render - Sending data to multiple Layouts

I'm trying to switch from PHP to GO, but I'm stuck at one point, I ask for your help. I linked navbar.html, which is where I will draw my menus and logo, into index.html. but I can't pull the data that I assigned for the index into the navbar from…
Ugur Tas
  • 216
  • 1
  • 9
1
vote
0 answers

Deploying a golang webserver made with fiber to an ubuntu server

I made a rest API using golang and Fiber. I have a VPS running Ubuntu. Right now I ssh into that server using vps.mydomain.com. I want to host the API I made on the Ubuntu server and I want to be able to access it using api.otherdomain.com. I do not…
dickey
  • 11
  • 1
  • 1
1
vote
1 answer

Using Websocket on goFiber

I try to sent console output of the execution command to html page via Websocket. I did not understand completely goFiber websocket example codes on this offical webpage. Firstly I think that I should sent only some dummy text to client. I watched…
swim
  • 119
  • 1
  • 9
1
vote
2 answers

How to make a GET request in Go Fiber to an API endpoint?

How to make a GET request in GO Fiber. I saw Fiber client but there is no working example code there. Could anyone kindly show me how to do that? suppose there is a API endpoint https://jsonplaceholder.typicode.com/posts How can I get the data from…
javmah
  • 99
  • 2
  • 6
1
vote
0 answers

golang cached data changes

This code is a simple code for caching static resources. If data stored in memory? caching. If not stored in memory or expired? proxing and cached. package main import ( "fmt" "strings" "sync" "time" …
HHJ
  • 99
  • 1
  • 8
1
vote
1 answer

Manage mutiple OS commands across apis (need to start stop on user request)

The scenario is I have to start n number of rtsp camera stream using ffmpeg command. The user has option to start number of streams and can form tiler, so he can see many streaming cameras similar to (NVR live view). I can start and stop stream…
Nitin
  • 29
  • 5
1 2
3
11 12