Fiber is a web framework for Go built on fasthttp. This article walks through a basic app and common framework areas. The example uses the Fiber v2 module path; framework APIs and security practices can change, so check the current documentation before building or deploying an application.
Install and start a simple app
go get github.com/gofiber/fiber/v2package main
import "github.com/gofiber/fiber/v2"
func main() {
app := fiber.New()
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Hello, World!")
})
app.Listen(":3000")
}Routes, handlers and middleware
Fiber routes can respond to HTTP methods such as GET, POST, PUT and DELETE. Small handlers can be inline; larger application logic is easier to maintain when separated into functions. Middleware added with app.Use() can handle work around routes, such as authentication, logging or CORS configuration.
Read and return request data
The article surveys fiber.Ctx for working with requests and responses: sending strings or JSON, reading query strings and route parameters, parsing request bodies, accessing raw bodies, and storing request-scoped values with Locals. It also covers static files with app.Static(), route groups and mounting sub-applications.
Errors, configuration and API security
Other topics include error handling, request IDs, logging, server settings, host and URL information, JSON and maps, and signup/login API examples using JWT authentication. Authentication and token handling require careful security design; the article’s outline is not a complete secure implementation.
This is an introductory framework tour, not an up-to-date production checklist. Review current Fiber documentation, Go guidance and security requirements for your project.
