# Weather Report API This API allows users to submit and retrieve weather reports. Authenticated users can submit weather reports for their own stations. Any user may retrieve weather reports. ## API Spec The OpenAPI specification can be found in [openapi.json](openapi.json). ## Environment Variables | Variable | Default | Description | | -------- | ------- | ----------- | | `PORT` | `3000` | Port to listen on for HTTP requests | | `NODE_ENV` | `development` | Development environment; may be set to `production`| | `DB_FILE` | `weather-reports.db` | Path to SQLite database file | ## Development 1. `npm install` to install dependencies 2. `npm run dev` to start the development server ## Usage ### Send a weather report Send a JSON weather report by POST-ing to `/v1/reports/{station_id}`, where `{station_id}` is any unique identifier for your station. For example, with CURL: ```sh curl -X POST http://localhost:3000/v1/reports/TEST \ -H "Content-Type: application/json" \ -d '{"latitude": 40.7128, "longitude": -74.0060, "temperature": 72.5, "pressure": 1013.5, "humidity": 50.0}' ``` ### Get the most recent report With CURL: ```sh curl http://localhost:3000/v1/reports/TEST ``` ### Get report history With CURL: ```sh curl http://localhost:3000/v1/reports/TEST/history?start=2020-01-01T00:00:00&end=2020-01-02T00:00:00 ``` Your result may include a `next` field. Add that to the query param to get the next set of results. For example: ```sh curl http://localhost:3000/v1/reports/TEST/history?start=2020-01-01T00:00:00&end=2020-01-02T00:00:00&next=1234 ```