Installing Fiber
Install Go
Get the latest version of Go from the official Golang website and follow the instructions.
Create Go Project
Initialize App
go mod init demoCreate main.go
Now create a file called main.go in the project directory write the following code in it:
main.go
package main
import (
"log"
"github.com/gofiber/fiber/v2"
)
func main() {
app := fiber.New()
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Hello, World 👋!")
})
log.Fatal(app.Listen(":3000"))
}The above code is actually the bare-bones to get the server respond with Hello, World 👋!
Create go.mod
Save the file and run the following command to update your go.mod
go mod tidyThis will create a go.sum file that ensures that future downloads of these modules retrieve the same bits as the first download, to ensure the modules your project depends on do not change unexpectedly, whether for malicious, accidental, or other reasons
Your project folder should contain the following file structure:
/ProjectDirectory
├── main.go
├── go.mod
└── go.sumRun App
Let’s launch our app by calling the following command:
go run main.goExplore Fiber
Fiber has a great community and online documentation that can help you creating fast and secure web apps.