This application has a front end developed using React.js and an API service implemented using Ballerina to demo a simple hotel reservation use case.
-
Run Ballerina Backend.
- Install Ballerina version 2201.8.4 if not already done.
- Navigate to the backend directory:
cd service
- Run
bal run
-
Start Front-end.
- Install Node.js version 20.x.x.
- Run
cd webapp
npm install
npm start
- Visit the
http://localhost:3000/reservations
- ballerina
- npm
-
Clone Git Repo https://github.com/ballerina-guides/hotel-reservation-demo
-
Goto backend directory.
-
Refer to
backend/README.md
and generate the Record types for the service. -
Add HTTP service component to implement API for the hotel reservation front end. It should provide the following API paths. Please refer to README.md for more on service resources.
- Get available room types
- Create a reservation
- Update the reservation
- Get user reservations
- Delete the reservation
-
Improve tests and add a reservation with the following reservation.
{
checkinDate: "2024-02-19T14:00:00Z",
checkoutDate: "2024-02-20T10:00:00Z",
rate: 100,
user: user,
roomType: "Family"
}
- Use two tables for Rooms and Reservations.
table<Room> key(number) rooms;
table<Reservation> key(id) roomReservations = table [];
- Use utils functions in utils.bal file.