DEV Community

Cover image for 📖 Go Fiber by Examples: How can the Fiber Web Framework be useful?

📖 Go Fiber by Examples: How can the Fiber Web Framework be useful?

Vic Shóstak on August 16, 2021

Introduction Hello and welcome, DEV friends! 👋 As you probably know, the printed book that we planned to release with Packt publisher ...
Collapse
 
artydev profile image
artydev

Awesome,
Thank you very very much :-)

Collapse
 
bengarrett profile image
Ben

Hi Vic, thankyou for the series of articles on this. I have couple of questions.

In the /go/routing.go sample there is

// Endpoint for PATH method
app.Path("/", func(c *fiber.Ctx) error {
  // function that replaces part of the existing data
})
Enter fullscreen mode Exit fullscreen mode

Should this be Patch? There doesn't seem to be a Path method in fiber/v2 and app.patch is also used by routing.js.

Also in /go/templates.go there is no mention of the module that needs to be imported for pug?

Collapse
 
koddr profile image
Vic Shóstak

Hi,

Should this be Patch? [...]

Wow, nice catch! My bad... Thanks, I fixed it in article 👍

[...] Also in /go/templates.go there is no mention of the module that needs to be imported for pug?

Function for Pug (and other supported template engines) was included to gofiber/template module. Call it, like this: github.com/gofiber/template/pug.

Collapse
 
jhoval profile image
Mauro Franchini

Thanks for sharing and writing this blogposts.. as someone said earlier, it's a shame that the development of the book stopped, but I guess it's for a good reason. Keep it rolling! Thanks for the time invested :)

Collapse
 
lexiebkm profile image
Alexander B.K.

I have a question of using Pug :
How to iterate on array/slice/map in Pug ?

For single values, we know the following will work :
h4= .Title
h4= .Message

This works too :
h4 #{.Title}
h4 #{ .Message}

But, how to use the usual pug syntax for iteration like the following ?
ul
each val in ["Java", "Go", "Rust", "C++", "FoxPro/Clipper"]
li= val

I have searched for this, but haven't found anywhere.

Collapse
 
marcello_h profile image
Marcelloh

A pity the book is not coming, but the very good thing is, that you're willing to share.
(and written in an understandable way :-) )

Collapse
 
junihh profile image
Junior Hernandez

I love it. Waiting for the next article. 😛

Collapse
 
nasoma profile image
nasoma

Amazing! Looking forward to the series. I have dabbled with Gin but have been looking to give Fiber a try. This series will be a great help.

Collapse
 
koddr profile image
Vic Shóstak

You're welcome! New article is coming 😉

Collapse
 
rngallen profile image
Luqman Jr

A good post about fiber. I always find how to use fiber to create API's, I would like to ask if you will share how to use fiber to save html templates as well as static files.