Fiber + EdgeOne Pages
Express-inspired web framework built on top of Fasthttp, the fastest HTTP engine for Go. Build fast, run fast.
cloud-functions/api.go
package main
import (
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/recover"
)
func main() {
app := fiber.New()
app.Use(recover.New())
app.Get("/", welcomeHandler)
app.Get("/health", healthHandler)
// Todo CRUD
api := app.Group("/api")
api.Get("/todos", listTodos)
api.Post("/todos", createTodo)
api.Get("/todos/:id", getTodo)
api.Patch("/todos/:id/toggle", toggleTodo)
api.Delete("/todos/:id", deleteTodo)
app.Listen(":9000")
}API Endpoints
GET/api/
Welcome page listing all available routes
GET/api/health
Health check endpoint returning service status
GET/api/api/todos
GET route returning all todos with total count
POST/api/api/todos
POST route with JSON body via c.BodyParser()
Request Body:
{
"title": "Learn Fiber Framework"
}GET/api/api/todos/1
Dynamic route parameter with c.Params("id")
PATCH/api/api/todos/1/toggle
Toggle todo completion status
DELETE/api/api/todos/3
Delete a todo by ID
Blazing Fast
Built on Fasthttp for maximum throughput and minimal latency
Express-like API
Familiar Express.js-style syntax for easy migration
Built-in Middleware
Rich ecosystem of built-in middleware for common tasks