NodeJS & ExpressJS-Day-2-Task-Hall Booking API
π It contains Hall Booking API - using Express server π
π©Create and Booking Rooms && List the Rooms and Customersπ©
π₯π₯π₯ Completed My Task π₯π₯π₯
π΄π΄
Kindly see my Answers in the npm run dev for kind attention Or
Use an app called "Postman" Or
Enter this link into the app called "Postman"
They are shown below πππ
π΄π΄
Method : POST
API : πππhttp://localhost:3000/createRoom
Request Data : { "seats": 5000, "amenities": ["Projector", "Budget Friendly Banquet Hall With 5 Star Hotel amenities in Erode"], "pricePerHour": 10000 }
Response Data : { "id": 1, "seats": 5000, "amenities": [ "Projector", "Budget Friendly Banquet Hall With 5 Star Hotel amenities in Erode" ], "pricePerHour": 10000 }
Method : POST
API : πππhttp://localhost:3000/bookRoom
Request Data : { "customerName": "Vijay", "date": "2023-12-20", "startTime": "10:00 AM", "endTime": "06:00 PM", "roomId": 1 }
Response Data : { "id": 1, "customerName": "Vijay", "date": "2023-12-20", "startTime": "10:00 AM", "endTime": "06:00 PM", "roomId": 1 }
404 status
{
"error": "The room is booked for that particular Date and Time"
}
Method : POST
API : πππhttp://localhost:3000/listRooms
Response Data : [ { "roomName": "Room 1", "bookedStatus": true, "bookings": [ { "id": 1, "customerName": "Vijay", "date": "2023-12-20", "startTime": "10:00 AM", "endTime": "06:00 PM", "roomId": 1 } ] } ]
Method : POST
API : πππhttp://localhost:3000/listCustomers
Response Data : [ { "customerName": "Vijay", "roomName": "Room 1", "date": "2023-12-20", "requested": "2023-12-19T22:32:34.576Z", "startTime": "10:00 AM", "endTime": "06:00 PM" } ]
Method : POST
API : πππhttp://localhost:3000//customerBookingHistory/Vijay
Response Data :
[
{
"customerName": "Vijay",
"roomName": "Room 1",
"date": "2023-12-20",
"startTime": "10:00 AM",
"endTime": "06:00 PM",
"bookingId": 1,
"bookingDate": "2023-12-10T12:00:00Z",
"bookingStatus": "Booked"
}
]