c64d61d78e
- Initialize go.mod with gitea.leeworks.dev/0xwheatyz/gitea-mobile
- Create directory structure: cmd/server/, internal/{config,gitea,handlers,middleware,templates}/, static/
- Add minimal HTTP server with /health and / endpoints
- Add flake.nix with Go toolchain, gopls, and air for live reload
Closes leeworks-agents/gitea-mobile#1
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
33 lines
646 B
Go
33 lines
646 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
addr := os.Getenv("LISTEN_ADDR")
|
|
if addr == "" {
|
|
addr = ":8080"
|
|
}
|
|
|
|
mux := http.NewServeMux()
|
|
|
|
mux.HandleFunc("GET /health", func(w http.ResponseWriter, r *http.Request) {
|
|
w.WriteHeader(http.StatusOK)
|
|
fmt.Fprintln(w, "ok")
|
|
})
|
|
|
|
mux.HandleFunc("GET /", func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
fmt.Fprintln(w, "<h1>Gitea Mobile</h1><p>Coming soon.</p>")
|
|
})
|
|
|
|
log.Printf("listening on %s", addr)
|
|
if err := http.ListenAndServe(addr, mux); err != nil {
|
|
log.Fatalf("server error: %v", err)
|
|
}
|
|
}
|