Simple REST API that returns the current status based on time of day and day of week.
GET /rust-api/api/v1/status
{
"time": "14:30",
"status": "lunch"
}GET /rust-api/api/v1/healthcheck
cargo runFor production deployment with Docker and Caddy reverse proxy, create a compose.yml file based on compose.yml.example:
services:
rust-api:
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
networks:
- caddy_net
labels:
- caddy=your-subdomain.yourdomain.com
- caddy.reverse_proxy={{upstreams 3003}}
- caddy.encode=zstd gzip
expose:
- 3003
env_file:
- .env
networks:
caddy_net:
external: trueReplace your-subdomain.yourdomain.com with your actual domain. Create a .env file with your environment variables.
Then run:
docker compose up -d --buildApache License Version 2.0