Goals (completed) :
- Desgined a POST API which creates new user with unique username : As mentioned in the Question, we donot have to create a User authentication. So for Indentification I used username as a identification for the user.
Route : http://localhost:3000/users/
- Designed a POST request API for creating Event :
Route: http://localhost:3000/events/
Required Body:
{
"event_type": "yoga",
"capacity":60,
"start_time":30,
"duration": 30
}
- Desgined a API for registering the Event :
Cases Handled:
- If user have already registered for the event , they willn't able to register again.
- If event's capacity have exceeded then user push into waiting list
- If event's capacity haven't exceeded then user able to register the event.
Route: http://localhost:3000/events/:eventid/regsiterevent
Headers Required :
username : (since i used username as identification. so it is required)
- Desgined a API by which user can cancel their registeration 30minutes before the event start
Cases Handled:
- User can able to cancel the event 30 min before the event start
- If user can able to cancle then it automatically confirm the registration of the first waiting user into main list if any waitlist user exits.
Route : http://localhost:3000/users/:username/cancelevent
Headers Required:
eventid : (Id of the Event that user want to cancel) (required)
time: (time in minutes when user want to try to cancel the registered event) (required)
node: v16.13.0
npm: 8.1.0
MongoDb
Dependencies
express
ejs
BodyParser
path
dotenv
mongoose
eslint
nodemon
eslint-plugin-prettier
cors
mongoose
Database
(1). MongoDb (locally setup)
cd Udaan/
npm install
npm start/nodemon
install mongoose local
npm install
npm start
- run
localhost:3000
in the browser
PostMan
Udaan Class Booking System uses Prettier + Eslint for code listing and formatting. To check if your code follows the guidelines, run npm run prettier