LTA API Project
This project is a command-line interface (CLI) for accessing the Singapore Land Transport Authority (LTA) DataMall APIs. It allows users to fetch bus arrival information, parking availability, nearest bus stops, and estimated travel time between two bus stops.
Installation
-
Clone the repository or download the project files.
-
Install the required dependencies using npm:
npm install
Usage
The following commands are available:
- Get bus arrival information:
npm run arr
- Get parking availability information:
npm run parking
- Find the nearest bus stops based on latitude and longitude:
npm run nearest
- Estimate the travel time between two bus stops:
npm run traveltime
Configuration
To use the LTA DataMall API, you need an API key. Create a .env
file in the root directory of the project and set the LTA_API_KEY
environment variable:
LTA_API_KEY=your_api_key_here
Replace your_api_key_here
with your actual LTA DataMall API key.
Dependencies
- axios - Promise-based HTTP client for Node.js
- dotenv - Loads environment variables from a
.env
file - yargs - A command-line argument parser for Node.js