Skip to content

Simple REST API that returns the current status based on time of day and day of week.

License

Notifications You must be signed in to change notification settings

skvggor/get-status-api-rust

Repository files navigation

Get Status API

Simple REST API that returns the current status based on time of day and day of week.

Endpoints

Status

GET /rust-api/api/v1/status
{
  "time": "14:30",
  "status": "lunch"
}

Health Check

GET /rust-api/api/v1/healthcheck

Run Locally

cargo run

Deploy with Docker

For 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: true

Replace your-subdomain.yourdomain.com with your actual domain. Create a .env file with your environment variables.

Then run:

docker compose up -d --build

License

Apache License Version 2.0

About

Simple REST API that returns the current status based on time of day and day of week.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published