Small example HTTP server written in Go. Serves HTML views, static assets, and a small API surface.
Requirements:
- Go 1.26+
Build:
make buildRun:
make run
# or
./bin/server
# or for development
go run ./cmd/serverThis project supports .env files (loaded automatically) and a few command-line flags.
- Environment file: copy
.env.example→.envand edit values. - Flags (highest priority):
-host(default0.0.0.0)-port(default8000)-resources(path served at/resources/for large files)-serve(addional path served at/)-version(prints binary version)
.env variables (examples in .env.example): HOST, PORT ...
views/, static/, and public/ are embedded into the binary via assets.go. The server always serves those embedded files at runtime; to change the content, edit the files under their respective folders and rebuild the binary.
- GET
/- home page (rendered with Gohtml/template) - GET
/*- addional path served at/route set by-serve - GET
/*- public assets served at/route - GET
/static/*- static assets - GET
/health- health check (JSON) - GET
/ready- readiness check (JSON) - GET
/resources/*- served from the path set by-resources - GET
/robots.txt
Templates are located in views/ and include:
layout.html— base layoutmeta.html— PWA/meta includeshome.html— home page content
MIT License