This project is the part of Hyperverge assignment.
To Setup a NodeJS server on EC2 to handle ticketing for a bus company. Context: 1 bus, 40 seats. One ticket per seat.
- Update the ticket status (open/close + adding user details)
- View Ticket Status
- View all closed tickets
- View all open tickets
- View Details of the person owning the ticket.
- Additional API for admin to reset the server (opens up all the tickets)
Use an appropriate database to handle the problem. The server needs to expose the features via APIs based on REST principles and event driven logic to be implemented in every possible situation. Additionally, write appropriate test cases to simulate practical scenarios that you would want to test the system for. Maintain the code through the course of the development on a version control system.
- Install node from nvm.
- Install mongodb and redis.
- Clone the repository.
- Run
npm install
inside the directory. - Make
.env
file and put it in base directory. - Run
npm test
to test andnpm start
to deploy.
- Add User (POST /add)
It will take name, email and mobile number from the body. - List all users (GET /search)
- Search the user (GET /search/:ID)
- Delete the user (DELETE /delete/:ID)
- Add Bus (POST /add)
It will take noofseats, start_time, end_time, start_station and end_station from the body. - List all buses (GET /search)
- Search bus (GET /search/:ID)
- Delete bus (DELETE /delete/:ID)
- Book a ticket (POST /book)
It will take busID and userID from body. busID and userID can be passed through frontend as the user has logged in to book the ticket and then will select the bus. - Cancel a ticket (PUT /cancel/:ID)
It will take ticketID in parameters. - Search a ticket (GET /search/:Id)
It will take ticketID in parameters. - Search ticket with given status (GET /Ticketstatus)
It will take status from query parameters.
- Reset the server/opens up all the tickets (PUT /bus/reset)
It will take busid from body.