A small Echo v4 API starter in Go 1.25 for developers who want Echo's router and middleware in a clean layout. It includes a JSON root route, a health check, slog request logs, panic recovery, graceful shutdown and table-driven tests.
by Light CloudREST APIs
The app is split the way Echo apps usually grow: server.New registers middleware and routes, handlers return an error, and Echo's error handler turns that error into a JSON response. main.go only reads PORT, starts the server and waits for a stop signal, so the first thing you change is handlers.go, adding routes such as e.GET("/items/:id", getItem). Light Cloud builds the Go module and runs it as a container listening on PORT, and each push to your copy redeploys it.
Write a handler with the signature func(c echo.Context) error in internal/server/handlers.go and register it in server.New, for example e.GET("/items/:id", getItem). Read the path value with c.Param("id") and reply with return c.JSON(http.StatusOK, item).
Return echo.NewHTTPError(http.StatusNotFound, "item not found") from the handler. Echo's default error handler sends it as JSON with that status, and the request logger records the 404.
The template already imports github.com/labstack/echo/v4/middleware, so add e.Use(middleware.CORS()) in server.New. Pass middleware.CORSWithConfig to limit the allowed origins.
Yes. It is a plain Go module with no Light Cloud code: make build writes bin/server, which runs on any Linux server or in a minimal container image with PORT set.
Yes. The repository is an MIT-licensed GitHub template, and it runs as a server app on Light Cloud's Free plan, which includes 3 server apps and needs no card.
Start a Go CRUD API on PostgreSQL with Gin, pgx, input validation and route tests
Start a Go API with Gin routing, slog request logs, panic recovery and route tests
Start a Go JSON API on the standard library alone, with logs, tests and a Dockerfile