Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Demonstrates a simple Fiber application with routes for listing and creating Todo items.
package main
import (
"github.com/gofiber/fiber/v2"
)
type Todo struct {
ID int `json:"id"`
Title string `json:"title"`
Completed bool `json:"completed"`
}
var todos []Todo
func main() {
app := fiber.New()
app.Get("/todos", func(c *fiber.Ctx) error {
return c.JSON(todos)
})
app.Post("/todos", func(c *fiber.Ctx) error {
var todo Todo
if err := c.BodyParser(&todo); err != nil {
return err
}
todos = append(todos, todo)
return c.Status(201).JSON(todo)
})
app.Listen(":3000")
}Fiber is an Express-inspired web framework written in Go, designed for high performance, minimal memory footprint, and fast HTTP handling. It leverages Go’s concurrency model for scalable web applications and APIs.
Origin & Creator
Created by Amir Salihefendić in 2020, Fiber was inspired by Node.js’ Express framework and built for Go developers seeking simplicity and speed.
Industrial Note
Fiber is widely used in Go-based microservices, API backends, and real-time systems where low latency and high throughput are critical.