Skip to content

Latest commit

 

History

History
39 lines (25 loc) · 2.5 KB

AGENTS.md

File metadata and controls

39 lines (25 loc) · 2.5 KB

AGENTS.md

Cursor Cloud specific instructions

Project overview

Weather Notification Slackbot for DeliveryOps — a single Node.js/Express backend that fetches real-time weather data for Klang Valley (Malaysia), Singapore, and Hong Kong, and sends formatted updates to Slack. It also serves an interactive weather map UI.

All application code lives under backend/. There is no monorepo structure and no database.

Running the application

cd backend && node index.js

The server starts on port 3000. It requires a backend/.env file (see README → Configuration). For local development without a real Slack workspace, use placeholder values for SLACK_BOT_TOKEN and SLACK_CHANNEL_ID — the server starts fine and all non-Slack endpoints work.

Key endpoints for verification

  • GET / — homepage with interactive weather map
  • GET /api/locations — location metadata
  • GET /api/weather/:locationKey — live weather data (singapore, hong-kong, klang-valley)
  • GET /api/status/:locationKey — combined weather + traffic
  • GET /send-notification — triggers Slack message (requires valid Slack credentials)

Without Slack secrets: Copy backend/.env.example to backend/.env with placeholder SLACK_BOT_TOKEN / SLACK_CHANNEL_ID. Weather and map endpoints work. /send-notification builds the full Slack payload but returns HTTP 500 with invalid_auth when Slack rejects placeholder tokens (configure real credentials via .env, Cursor secrets, or the in-app Slack Settings panel, which persists to backend/config/runtime-settings.json).

Google Maps: Set GOOGLE_MAPS_API_KEY in .env for the interactive map on /; without it the homepage still loads but the map shows a Google Maps load error.

Linting and testing

  • No linter is configured (no ESLint/Prettier).
  • Jest + Supertest: cd backend && npm test runs suites under backend/__tests__/. Tests import app from app.js directly (not index.js), so they do not bind port 3000. Some tests may fail if they drift from current API behavior (status codes, traffic URLs, error messages).
  • First-time env: cp backend/.env.example backend/.env before starting the server.

Gotchas

  • The body-parser package is used but not listed in package.json dependencies — it works because Express v4 bundles it, but imports may produce warnings in some environments.
  • Puppeteer (for map screenshots) requires Chromium system dependencies. It is not needed for core weather/API functionality.