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
1 answer

how to deal with websocket disconnection issue, status code 1006 in /gofiber/websocket

I am trying to create chat application. Constantly facing websocket connection closing with status 1006 even though ping pong is established. How to deal with the disconnection? The package we are using is github.com/gofiber/websocket/v2
0
votes
1 answer

How to use structure a bson query with query,where and in using go

I would like to get document entries based on time range and a field that is used in $in. I can do it very easily using mongoose and nodejs like so where param is the key and params is an array Data.find( { timestamp: …
Barty
  • 164
  • 3
  • 10
0
votes
1 answer

How to declare swagger properties within go fiber Router function

I generating swagger documentation using fiber swagger package. I have grouped routes that I use exclusively within their domains. when i make the declarations above the function it works well // GetDevices godoc // @Summary Get all Devices // @ID…
Barty
  • 164
  • 3
  • 10
0
votes
2 answers

How to declare something like empty Object/Struct inside Struct?

Hi i am process of learning the Go language, and i want to ask how to create empty Object/Struct as domain model data type? i am using Fiber as my framework and here is the example of what i want to get from golang response api is something like…
Ke Vin
  • 3,478
  • 11
  • 60
  • 91
0
votes
2 answers

Getting "Missing or malformed Token" while using gofiber firebase-auth

I am trying to run Gofiber firebase-auth. I have generated a private key from Firebase Console, Settings -> Service Account -> Generate new private key and have given the file path to: .env: GOOGLE_SERVICE_ACCOUNT =…
Amit Dubey
  • 75
  • 1
  • 8
0
votes
1 answer

How do I parse the password as a byte array with fiber

I am using Go fiber's body parser to parse the request body. I have the following struct type SignInCredentials struct { Email string Password []byte } Where I have a Password as a slice of bytes. When I try to parse the body like…
anonymous-dev
  • 2,897
  • 9
  • 48
  • 112
0
votes
1 answer

How to shrink this code and merge the if and else condition

if category == 0 { rows, err := h.Repo.GetAllLatestProducts(c.Context()) if err != nil { return c.Status(fiber.StatusInternalServerError).SendString(err.Error()) } result := make([]interface{},…
Priyank Bolia
  • 14,077
  • 14
  • 61
  • 82
0
votes
1 answer

Increment struct value in Go

I'm expecting to see the visits increment with every GET request to /foo but it remains as 1. What am I doing wrong here? package main import ( "log" "github.com/gofiber/fiber/v2" "gorm.io/driver/sqlite" "gorm.io/gorm" ) // Item…
stackunderflow
  • 1,644
  • 6
  • 24
  • 40
0
votes
1 answer

Unable to preload clause.Associations

I am using GORM in combination with Fiber. When querying all users with preloaded clause.Associations I get the following error: can't preload field @@@as@@@ for entities.User What does that mean? Without the preload of clause.Associations it works…
Heikkisorsa
  • 740
  • 9
  • 31
0
votes
0 answers

Golang with MySQL driver

I have been learning golang in the last couple days, but I am so frustrated because I am trying to make a simple CRUD api and I can't create a simple user. I am using Fiber (very similar to Express.js) with golang's sql with mysql driver. Here is my…
learnbydoing
  • 309
  • 1
  • 5
  • 14
0
votes
1 answer

Passing the payload of one API request to API call 2

I like to create two API in which request is made to get information in one API and the insertion to the db is made in another API call. How could I able to achieve this in Fiber. consider the following code block func getName(c *fiber.Ctx) { //…
Balaji.J.B
  • 618
  • 7
  • 14
0
votes
3 answers

Go fiber not running on localhost

I am using this web framework for go: https://github.com/gofiber/fiber I want to run the basic example they gave called "hello world" I copied the code and put it in a file called main.go // ⚡️ Fiber is an Express inspired web framework written in…
bobdylan01
  • 158
  • 2
  • 10
-1
votes
1 answer

Cannot GET /api/user

Here is my authController.go file package controllers import ( "strconv" "github.com/ADEMOLA200/go-admin/database" "github.com/ADEMOLA200/go-admin/models" "github.com/dgrijalva/jwt-go" …
-1
votes
1 answer

Main.go won't run after correct build

I started learning go and made a crm app, just to find that after building main, it won't run. This is the error shown in the terminal: PS crm-go-fiber> go build .\main.go PS crm-go-fiber> go run .\main.exe main module…
Diego Cid
  • 17
  • 3
-1
votes
1 answer

Should I run a goroutine for each api request using Fiber?

So I am using Fiber to build a Rest API and I was wondering on whether or not to run each handler function in a goroutine. For example, say I have the following routes: router.Get("/get", getMockData) router.Post("/create",…
darkstar
  • 829
  • 11
  • 23