The following endpoints have been implemented:
- POST /api/auth/register - For registering new users
- POST /api/auth/login - For authentication and role based access control for other endpoints
- POST /api/trains - For adding new trains (Accessible to admins only)
- GET /api/trains - For getting seat availability of all trains between a source and a destination station
- POST /api/bookings/:trainId - For booking a seat in the train with id equal to trainId
- GET /api/bookings/:trainId - For getting book details of the train with id equal to trainId
How to run this application?
- Clone the repository.
- Install the packages:
npm install - Create a
.envfile. Copy the contents of the.env.localfile. Replace theuser,passwordandmydbwith your own. - Build the JavaScript code from TypeScript code:
npm run build - Run the server:
npm run start