Building REST APIs with Go
Go’s standard library has everything you need for a solid REST API.
Minimal Server
package main
import (
"encoding/json"
"net/http"
)
func main() {
http.HandleFunc("/api/health", func(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(map[string]string{"status": "ok"})
})
http.ListenAndServe(":8080", nil)
}
No framework needed for small services. The stdlib is surprisingly capable.