{"id":18624005,"url":"https://github.com/a-samod/sri-lanka-railways-location-api","last_synced_at":"2026-04-17T11:31:37.754Z","repository":{"id":254842344,"uuid":"847617121","full_name":"A-Samod/sri-lanka-railways-location-api","owner":"A-Samod","description":"A Node.js REST API for Sri Lanka Railways to manage and retrieve real-time GPS location data of trains, with a 90-day data retention policy and CRUD operations on train data.","archived":false,"fork":false,"pushed_at":"2024-08-31T15:35:12.000Z","size":37,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-17T06:41:21.392Z","etag":null,"topics":["express","gps-tracking","location-data","mongodb","nodejs","rest-api","sri-lanka-railways","transportation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/A-Samod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-26T08:00:35.000Z","updated_at":"2025-03-20T04:20:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"75e59ec9-ff2e-4780-8808-3baa6eba4cd1","html_url":"https://github.com/A-Samod/sri-lanka-railways-location-api","commit_stats":null,"previous_names":["a-samod/train-be"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/A-Samod/sri-lanka-railways-location-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/A-Samod%2Fsri-lanka-railways-location-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/A-Samod%2Fsri-lanka-railways-location-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/A-Samod%2Fsri-lanka-railways-location-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/A-Samod%2Fsri-lanka-railways-location-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/A-Samod","download_url":"https://codeload.github.com/A-Samod/sri-lanka-railways-location-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/A-Samod%2Fsri-lanka-railways-location-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31927692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T10:35:34.458Z","status":"ssl_error","status_checked_at":"2026-04-17T10:35:09.472Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express","gps-tracking","location-data","mongodb","nodejs","rest-api","sri-lanka-railways","transportation"],"created_at":"2024-11-07T04:27:00.997Z","updated_at":"2026-04-17T11:31:37.730Z","avatar_url":"https://github.com/A-Samod.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sri Lanka Railways Location API\n\nThis Node.js application serves as a RESTful API for Sri Lanka Railways, handling the ingestion, storage, and retrieval of real-time GPS location data for trains. The API supports CRUD operations on train data and maintains a 90-day data retention policy, allowing clients to access both current and historical location information.\n\n## Features\n\n- Ingest and store real-time GPS location data for trains.\n- Retrieve current and historical location data.\n- Maintain a 90-day data retention policy with automatic cleanup.\n- Perform CRUD operations on train data with history logging.\n\n## Prerequisites\n\n- Node.js (v14 or higher)\n- MongoDB\n- npm (Node Package Manager)\n\n## Installation\n\n1. **Clone the repository:**\n   ```bash\n   git clone https://github.com/your-username/sri-lanka-railways-location-api.git\n   ```\n   ```bash\n   cd sri-lanka-railways-location-api\n   ```\n   \n2. **Install dependencies:**\n   ```bash\n   npm install\n   ```\n4. **Set up environment variables:**\n   ```bash\n   MONGO_URI=mongodb://localhost:27017/railways\n   ```\n   ```bash\n   PORT=5000\n   ```\n5. **Start the application:**\n   ```bash\n   npm start\n   ```\n\n## API Endpoints\n\n- POST /location: Ingest GPS location data for a train.\n- GET /location/:trainId: Retrieve the current location of a specific train.\n- GET /location/history/:trainId: Retrieve historical location data for a specific train.\n- GET /train-history: Retrieve CRUD operation history for trains.\n- GET /location-history: Retrieve creation history logs for locations.\n\n  ![image](https://github.com/user-attachments/assets/a954a9ff-b995-446b-a4ae-09d969af429f)\n\n\n## Data Retention and Cleanup\nThe application automatically deletes location data older than 90 days, managed by a cron job running daily at midnight.\n\nLicense\nThis project is licensed under the MIT License. See the [LICENSE](https://github.com/A-Samod/sri-lanka-railways-location-api?tab=MIT-1-ov-file#readme) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-samod%2Fsri-lanka-railways-location-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa-samod%2Fsri-lanka-railways-location-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-samod%2Fsri-lanka-railways-location-api/lists"}