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

Am trying to create a database with gorm by taking the users inpute using and api like structure e.g c.BodyParser(new(User))

var ( err error User []AcctDetails ) type ( AcctDetails struct { gorm.Model ID uint AcctName string gorm:"default:John Doe" AcctNumber string UsersPhoneNo string } ) func CreateDb(c fiber.Ctx) error { db :=…
1
vote
1 answer

How to query data where column is not null in gorm

Here is my two models, I want to have my code return all the paths which has nodes inside them, and exclude all the path which has no nodes inside them type Path struct { gorm.Model ID uuid.UUID `json:"id"…
Manas Paul
  • 86
  • 1
  • 9
1
vote
2 answers

What whould be the best way to forward a request by adding headers?

I just started to use Golang and I want to remake my already working NodeJS/TypeScript app in Go. One endpoint of my API simply adds server-side generated authorization headers and sends a request to a remote API. Basically filling those headers for…
nanoK
  • 51
  • 5
1
vote
1 answer

how do i enforce the proper data types on gofiber golang from POST data from frontend?

I am receiving the following POST request json data from react frontend { "field_one": "first", "field_two": "second", "field_three": "3.00" } but i want golang to convert it to this before processing the request { "field_one":…
uberrebu
  • 3,597
  • 9
  • 38
  • 73
1
vote
1 answer

Sqlite3 giving error while running the program

I was following along with a tutorial and had to use SQLite since it was beginner-friendly after everything while running the command go run main.go I'm getting an error telling # github.com/mattn/go-sqlite3 cc1.exe: sorry, unimplemented: 64-bit…
BAVAN M Y
  • 29
  • 2
1
vote
1 answer

How do i grab the jwt payload data from a cookie created with gofiber golang framework?

I have the following function to create a server side HTTPOnly with gofiber framework using the v2 version "github.com/gofiber/fiber/v2" func Signin(c *fiber.Ctx) error { type SigninData struct { Email string `json:"email"…
uberrebu
  • 3,597
  • 9
  • 38
  • 73
1
vote
1 answer

Returning array like json with Fiber, Golang

I have a table with columns token, user_id and last_seen in my databse The task is to send all of them with my app when it gets a get request Fiber, Golang: type sessionsInfo struct { token string user_id int …
1
vote
0 answers

403 CSRF token error after setting csrf token to browser in GOFIBER

In GoFiber, After setting the csrf token to my browser, it expired soon but my expiration date is set for 1 day. app.Use(csrf.New(csrf.Config{ KeyLookup: "header:X-Csrf-Token", CookieName: "csrf_bongo", …
1
vote
2 answers

"crypto/bcrypt: hashedPassword is not the hash of the given password"

After registering a user, I try to login with same password but I cannot login due to error. I passed encrypt password and plain password to compare function. But I cannot log in. type request struct { PhoneNumber string `json:"phone_number"` …
1
vote
1 answer

Go: client is disconnected

It's been few weeks since I joined in Gophers team. So far so good. I started a new project using a fiber web framework to build backend APIs. I am using MongoDB as my database. database/db.go package database import ( "context" "log" …
The Rock
  • 323
  • 1
  • 8
  • 18
1
vote
1 answer

Why do I keep getting this message when I try to download a go package?

C:\Users\Administrator\Documents\code\projects\weatherly>go get -u github.com/gofiber/fiber/v2 cannot find package "github.com/gofiber/fiber/v2" in any of: c:\go\src\github.com\gofiber\fiber\v2 (from $GOROOT) …
1
vote
1 answer

How to handle chunked file upload

I'm creating a simple application where it allows users to upload big files using simple-uploader since this plugin sends the files in chunks instead of one big file. The problem is that when I save the file the first chunk is the only one that is…
ginad
  • 1,863
  • 2
  • 27
  • 42
1
vote
1 answer

GET 404 Not Found when loading stylesheet

I am having problems with Go Fiber's Static file server. I want to load a css stylesheet which is used within a template. The template itself works fine. func main() { // Create a new engine. engine := html.New("./views", ".html") //…
buttery
  • 11
  • 3
1
vote
1 answer

Partial updates of objects

I want to enable update functionality for my User object in my fiber/gorm backend. It works fine when I update all fields together using the Save function. However, when I do not have all fields present in the update request (for example only the…
Heikkisorsa
  • 740
  • 9
  • 31
0
votes
1 answer

How to solve write: broken pipe on websocket?

I'm making a progress bar for my program, and send it to client. The IPC I used is websocket. But I'm facing write: broken pipe when updating progress bar to the client. This error occurs after the first request. For example, on initial run of my…
newtocoding
  • 97
  • 2
  • 5