This is a simple RESTful API for hotel booking created using Node.js, Express, and Joi for input validation.
To use the API, you can follow these steps:
-
GET all bookings:
Send a GET request to/api/bookings
to retrieve all bookings. -
POST a new booking:
Send a POST request to/api/bookings
with the following JSON body:{ "name": "John Doe", "checkIn": "2024-03-01", "checkOut": "2024-03-05", "roomType": "suite" }
To run the app locally, you need to follow these steps:
-
Clone this repository to your local machine.
-
Navigate to the project directory in your terminal.
-
Install dependencies by running
npm install
. -
Start the server by running
node index.js
. -
The server will start running on port 3000 by default. You can access the API endpoints by sending requests to
http://localhost:3000
.
To contribute to this repository, you can follow these steps:
- Fork the repository.
- Clone the forked repository to your local machine.
- Create a new branch for your changes:
git checkout -b my-feature
. - Make your changes and commit them:
git commit -am 'Add my feature'
. - Push to the branch:
git push origin my-feature
. - Submit a pull request.
Thank you for contributing!