ALOS HTTP is a Linux amd64 web framework built around native io_uring, native TLS 1.3, and HTTP/2. This guide gets a Linux server running quickly and points out the current compatibility limits for streaming and hijack-based APIs.
Install the module with a single command:
go get github.com/guno1928/alos-http
ALOS HTTP's documented production runtime is Linux amd64. The native
server path is built around io_uring.
Requires Go 1.25 or later. That matches the module's current
go.mod.
The fastest way to get a server running:
mkdir myapp && cd myapp go mod init myapp go get github.com/guno1928/alos-http
package main import ( "log" "github.com/guno1928/alos-http/core" ) func main() { s := core.New() s.Router.GET("/", func(req *core.Request, resp *core.Response) { resp.String("Hello from ALOS!") }) s.Router.Build() log.Fatal(s.ListenAndServe()) }
go run main.go
Your server is now running at http://localhost:80. On Linux amd64, ALOS
will prefer its native io_uring server path when the kernel supports it.
For development or internal services, start a plain HTTP server with no TLS overhead:
s := core.New(core.Config{ Addr: ":8080", PlainHTTP: true, }) s.Router.GET("/", func(req *core.Request, resp *core.Response) { resp.JSON([]byte(`{"status":"ok"}`)) }) s.Router.Build() log.Fatal(s.ListenAndServe())
ALOS uses its own native TLS 1.3 serving path on the main Linux runtime.
Older TLS 1.2/1.1 clients can still fall back through Go's crypto/tls
compatibility path when needed. You can use manual certificates or auto-generate
self-signed ones:
s := core.New(core.Config{ Addr: ":443", TLSCertFile: "cert.pem", TLSKeyFile: "key.pem", }) s.Router.Build() log.Fatal(s.ListenAndServeTLS())
s := core.New(core.Config{ Addr: ":443", }) s.Router.Build() log.Fatal(s.ListenAndServeTLS())
The self-signed cert is saved to .alos-cert.pem and .alos-key.pem
and reused on subsequent runs.
ALOS integrates with Let's Encrypt for automatic, free TLS certificates. Just provide your email and domain names:
s := core.New(core.Config{ Addr: ":443", HTTPAddr: ":80", ACME: &core.ACMEConfig{ Email: "admin@example.com", Domains: []string{"example.com", "www.example.com"}, CacheDir: ".alos-certs", }, }) s.Router.Build() log.Fatal(s.ListenAndServeTLS())
What happens automatically:
.alos-certs/ directoryRegister routes with the built-in router. ALOS supports all standard HTTP methods:
s.Router.GET("/hello", func(req *core.Request, resp *core.Response) { resp.String("Hello, World!") }) s.Router.GET("/users/:id", func(req *core.Request, resp *core.Response) { id := req.ParamValue("id") resp.JSON([]byte(`{"user":"` + id + `"}`)) }) s.Router.POST("/api/data", func(req *core.Request, resp *core.Response) { body := req.Body resp.Status(201).Bytes(body) }) s.Router.Build()
For more advanced routing, see the Routing documentation.
Apply middleware globally or per-group. ALOS includes several production-ready middleware:
s.Router.Use(core.Recovery()) s.Router.Use(core.Logger()) s.Router.Use(core.RealIP()) s.Router.Use(core.RequestID()) s.Router.Use(core.SecurityHeaders(core.DefaultSecurityHeaders())) s.SetCORS(core.CORSConfig{ AllowOrigins: []string{"*"}, AllowMethods: []string{"GET", "POST", "PUT", "DELETE"}, }) s.Router.Use(s.CORS.Middleware()) s.Router.Build()
For detailed middleware configuration, see the Middleware documentation.
ALOS provides multiple ways to send JSON data:
s.Router.GET("/api/status", func(req *core.Request, resp *core.Response) { resp.JSON([]byte(`{"status":"ok","version":"1.0"}`)) })
type User struct { ID int `json:"id"` Name string `json:"name"` } s.Router.GET("/api/user", func(req *core.Request, resp *core.Response) { user := User{ID: 1, Name: "Alice"} resp.JSONMarshal(user) })
s.Router.POST("/api/users", func(req *core.Request, resp *core.Response) { var user User if err := json.Unmarshal(req.Body, &user); err != nil { resp.Status(400).JSON([]byte(`{"error":"invalid json"}`)) return } resp.Status(201).JSONMarshal(user) })
Putting it all together — a production-ready HTTPS server with routing, middleware, and JSON:
package main import ( "log" "github.com/guno1928/alos-http/core" ) func main() { s := core.New(core.Config{ Addr: ":8080", PlainHTTP: true, }) s.Router.Use(core.Recovery(), core.Logger(), core.Compress(core.CompressConfig{})) s.Router.GET("/", func(req *core.Request, resp *core.Response) { resp.String("Welcome to ALOS HTTP") }) s.Router.GET("/health", func(req *core.Request, resp *core.Response) { resp.JSON([]byte(`{"status":"ok"}`)) }) api := s.Router.Group("/api/v1", core.RealIP()) api.GET("/users/:id", func(req *core.Request, resp *core.Response) { id := req.ParamValue("id") resp.JSONMarshal(map[string]string{"id": id}) }) api.POST("/users", func(req *core.Request, resp *core.Response) { resp.Status(201).Bytes(req.Body) }) s.Router.NotFound(func(req *core.Request, resp *core.Response) { resp.Status(404).JSON([]byte(`{"error":"not found"}`)) }) s.Router.Build() log.Fatal(s.ListenAndServe()) }