☁️ Weather-Time API

Serves server time and weather data for multiple locations, plus Docker host status.

Endpoints

Configuration

Create a .env file (not checked into Git):

PORT=3000
WEATHER_API_KEY=your_weatherapi_key
WEATHER_LOCATIONS=Portland, ME|Wallkill, NY|Hollis Center, ME
REFRESH_INTERVAL_MS=600000
    

Running Locally

  1. Install dependencies:
    npm install
  2. Start the server:
    npm start
  3. Visit http://localhost:3000 to view this docs page.

Docker Deployment

1. Build the image

docker build -t weather-time-api:latest .

2. Run with host’s Docker socket (Windows)

This lets /docker/liststate inspect your other containers.

docker run -d \
  --name weather-time-api \
  -p 3000:3000 \
  -v \\.\pipe\docker_engine:\\.\pipe\docker_engine \
  -e DOCKER_SOCKET=\\\\.\\pipe\\docker_engine \
  -e WEATHER_API_KEY=6df6a37fc8944aab967191634242209 \
  --env WEATHER_LOCATIONS="Portland, ME|Wallkill, NY|Hollis Center, ME|Scarborough, ME|Warwick, NY|Patterson, NY|Fishkill, NY" \
  --restart=always \
  weather-time-api:latest
    

3. Verify

curl http://localhost:3000/docker/liststate | jq .