# Go HTTP API

> A small Go API on the standard library, with structured JSON logs, a health check and a graceful shutdown.

A Go API on net/http with no framework, structured JSON logs, a health check and a graceful shutdown when a new deploy replaces it. Click Deploy and Naijacloud compiles it from the public repo and gives you a live HTTPS address. No GitHub connection needed.

- Use case: API
- Stack: Go
- Code: https://github.com/naijacloud/template-go-api (branch `main`)
- Deploy: https://naijacloud.com/new?template=go-api&ref=template-go-api
- Free tier: fits (1 app per workspace)
- Last verified on Naijacloud: 9 Oct 2026
- Page: https://naijacloud.com/templates/go-api

## What's inside

- Go 1.22 net/http routing, no framework
- Structured JSON logs through log/slog
- /healthz, /api/time and /api/hello/<name>
- A graceful shutdown on SIGTERM, so a redeploy drops no requests

## What you get after deploying

- A live address at https://go-api.naijacloud.app with HTTPS
- Build and runtime logs, metrics and redeploys from the dashboard

## Environment variables

| Name | What it is for | Default |
| --- | --- | --- |
| `LOG_LEVEL` | debug, info, warn or error | `info` |

## Example request

```bash
curl -i https://go-api.naijacloud.app/healthz
```

```
HTTP/2 200
content-type: application/json

{"status":"ok","version":"1.0.0"}
```

## Run it locally

```bash
git clone https://github.com/naijacloud/template-go-api
cd template-go-api
go run .
```

Learn how it works: [Deploy a web service](https://naijacloud.com/docs/deploy/web-services)

All templates: https://naijacloud.com/templates
