1.3 KiB
1.3 KiB
OpenStreetMap Service
Web service for displaying markers, circles, and alerts on OpenStreetMap.
Quick Start
npm install
npm start
Visit http://localhost:3000
API Documentation
Swagger UI documentation is available at: http://localhost:3000/api-docs
JSON schema available at: http://localhost:3000/api-docs.json
API Endpoints
Add Marker
GET /api/marker?lat=<lat>&lng=<lng>&icon=<icon>&title=<title>
Add Circle
GET /api/circle?lat=<lat>&lng=<lng>&radius=<radius>&icon=<icon>&title=<title>
Create Alert
POST /api/alert?message=<message>&type=<type>
Parameters:
message(required) - Alert text contenttype(optional) - Alert style: danger (red), warning (orange), info (blue), success (green). Default: danger
Example:
curl -X POST "http://localhost:3000/api/alert?message=Server%20Error&type=danger"
Get Alerts
GET /api/alerts
Clear All Alerts
POST /api/alerts/clear
How Alerts Work
- The map page at http://localhost:3000 polls for new alerts every 3 seconds
- When you call
POST /api/alert, the alert is stored on the server - Any open map page will automatically display the new alert prominently
- Alerts appear in the top-right corner of the map with animation
- Each alert can be dismissed individually or cleared all at once