This Node.js project is a Proof of Concept (POC) for adding location tracking to public buses, with the goal of making public transportation more accessible and efficient while reducing bus stop waiting times. It leverages technologies such as Express, MongoDB, Socket.IO, and Nunjucks to achieve this.
- Real-time bus location tracking is implemented using Socket.IO.
- The project allows buses to send their current locations to the server, which is then broadcasted to clients in real-time.
- User authentication can be integrated to access specific functionalities.
- User sessions can be managed to provide personalized experiences.
- MongoDB is used to store bus location data.
- The
Location
model is defined to structure the data.
- The project exposes a RESTful API for various operations.
- Endpoints include
/api/locations
for posting bus locations and/api/users
for user-related operations.
Before running this project, ensure that you have the following dependencies and setup:
- Node.js installed on your system.
- MongoDB database connection available.
- Necessary npm packages installed by running
npm install
in the project directory.
-
Clone this repository to your local machine:
git clone https://github.com/your-username/public-bus-tracking.git cd public-bus-tracking
-
Install the required npm packages:
npm install
-
Configure the MongoDB connection by editing the MongoDB URI in
index.js
. -
Start the server:
npm start
The application should now be running locally on http://localhost:3000
.
- Visit
http://localhost:3000
in your web browser. - Explore the various functionalities of the application.
- Endpoint:
/api/locations
- Description: Posts the current location of a bus.
- Request Body:
name
(optional): Name of the bus.lat
: Latitude coordinate of the bus.lon
: Longitude coordinate of the bus.
- Endpoint:
/api/users
- Description: Perform user-related operations (e.g., authentication, registration).
If you'd like to contribute to this project, please fork the repository and create a pull request with your changes. We welcome contributions from the community.
This project is licensed under the MIT License.
- Your Name
- Contact: your.email@example.com
Feel free to contact the author with any questions or feedback regarding this project.