Examples
Every example lives in example/,
is its own Go module, and has a Makefile with test, build, lint, fmt,
and vet targets.
| Example | Runs with | What it shows |
|---|---|---|
| hello-world | nothing | The smallest possible app: one inline handler, no services, no config |
| hello-world-2 | nothing | Service lifetimes, route groups, binding and validation, custom error handling |
| templates-basic | nothing | Server-rendered HTML with gas/ui: layouts, partials, static files |
| lambda-worker | Postgres, SQS | gas.Worker instead of gas.App, for AWS Lambda and background jobs |
| api-server | Postgres, LocalStack | A real API: auth, database, storage, queue, email, and cache together |
Running one
Section titled “Running one”git clone https://github.com/gasmod/gascd gas/example/hello-worldgo run ./cmd # http://localhost:8080hello-world-2 and templates-basic also run with no external services. For
api-server, bring up Postgres and LocalStack first:
cd example/api-serverdocker compose up -dcp .env.example .envgo run ./cmdThe HTTP examples drive a real server built from App.Handler(), so their tests
exercise the same middleware and CSRF stack as production without binding a
port. lambda-worker tests its handler through the worker’s DI container.
make test-all # from the repo root, every module and example