45 lines
802 B
Markdown
45 lines
802 B
Markdown
# Test Backend - Saudi Meters API
|
|
|
|
A simple Express.js server that serves the Saudi meters GeoJSON data.
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Development Mode
|
|
```bash
|
|
npm run dev
|
|
```
|
|
|
|
### Production Mode
|
|
```bash
|
|
npm run build
|
|
npm start
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
- `GET /` - API information and available endpoints
|
|
- `GET /api/meters` - Get all meters data (GeoJSON FeatureCollection)
|
|
- `GET /api/meters/:id` - Get specific meter by ID
|
|
- `GET /health` - Health check endpoint
|
|
|
|
## Example Usage
|
|
|
|
```bash
|
|
# Get all meters
|
|
curl http://localhost:3001/api/meters
|
|
|
|
# Get specific meter
|
|
curl http://localhost:3001/api/meters/meter-757
|
|
|
|
# Health check
|
|
curl http://localhost:3001/health
|
|
```
|
|
|
|
The server runs on port 3001 by default, but you can override it with the `PORT` environment variable.
|