Use the standard library net/http for simple services and chi for lightweight routing; skip frameworks like Gin unless you need heavy middleware or rapid prototyping features. The standard library provides zero-dependency performance, while chi adds a clean router on top of it without the overhead of full frameworks.
package main
import (
"net/http"
"github.com/go-chi/chi/v5"
)
func main() {
// Standard library only (zero deps)
// http.HandleFunc("/", handler)
// http.ListenAndServe(":8080", nil)
// With Chi (lightweight routing)
r := chi.NewMux()
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello"))
})
http.ListenAndServe(":8080", r)
}