This project aims to provide a TypeScript translation of the Hotel Reservation microservice from the DeathStarBench repository.
The Hotel Reservation microservice is responsible for handling hotel reservations in the DeathStarBench system. It interacts with other microservices to manage hotel availability, customer information, and booking details.
This project provides a TypeScript implementation of the Hotel Reservation microservice. It utilizes the Express framework for building the server and includes the necessary modules and dependencies for its functionality. The translation aims to maintain the logic and functionality of the original microservice while adapting it to a TypeScript environment.
- Node.js (v12.4 or later)
- npm (Node Package Manager)
- TypeScript (v4.4 or later)
P.S Some additional dependencies might also be required due to the use of the mongodb-memory-server
package.
Follow these steps to set up and run the Hotel Reservation microservice:
- Install dependencies (
npm install
) - Run the project (
npm run dev
) - The server will be running on port 3000 by default. You can change this in the
src/index.ts
file or through thePORT
env variable. - The port for the gRPC server is set to 50051. You can change this in the
src/index.ts
file or through theGRPC_PORT
env variable.
Note:
Send a POST
request to the /hotels
endpoint with a list of hotel IDs to fetch their profiles. The request body should be in the following format:
{
"HotelIds": ["HotelId1", "HotelId2", ...] // '1', '2', ...
}
Send a gRPC
request to the localhost:50051
endpoint with a list of hotel IDs to fetch their profiles:
{
"hotelIds": ["HotelId1", "HotelId2", ...] // '1', '2', ...
"locale": "officia velit" // unused field
}