This Node.js application simulates GPS data for 10 trains operating on 3 routes in Sri Lanka. It generates and transmits GPS data at one-minute intervals to the sri-lanka-railways-location-api
, enabling real-time location tracking.
- Simulate real-time GPS data for 10 trains across 3 major routes in Sri Lanka.
- Transmit GPS data to the backend API at one-minute intervals.
- Configurable transmission interval through environment variables.
- Node.js (v14 or higher)
- npm (Node Package Manager)
- MongoDB (for train data storage)
-
Clone the repository:
git clone https://github.com/your-username/sri-lanka-railways-gps-data-generator.git
cd sri-lanka-railways-gps-data-generator
-
Install dependencies:
npm install
-
Set up environment variables:
BACKEND_API_URL=http://localhost:5000/api/v1
INTERVAL_MS=60000 # Interval for GPS data transmission (in milliseconds)
MONGO_URI=mongodb://localhost:27017/railways # Connection string for MongoDB
-
Start the application:
npm start
- BACKEND_API_URL: The URL of the backend API where GPS data is transmitted.
- INTERVAL_MS: The interval (in milliseconds) at which GPS data is generated and transmitted. Default is 60000 ms (1 minute).
- MONGO_URI: The connection string for the MongoDB database that stores train data.