This is the backend application for a hotel management system. It provides APIs for user authentication, room management, booking management, and other related functionalities.
- Node.js: JavaScript runtime environment
- Express.js: Web application framework
- MongoDB: NoSQL database for data storage
- Mongoose: Object Data Modeling (ODM) library for MongoDB
- JWT (JSON Web Tokens): Authentication mechanism
- bcryptjs: Library for password hashing
- Other dependencies as specified in the project files
-
Clone the repository:
git clone https://github.com/your-username/hotel-backend.git
-
Navigate to the project directory:
cd hotel-backend
-
Install the dependencies:
yarn install
-
Create a
.env
file in the project root directory. -
Add the required environment variables to the
.env
file. Example:# MongoDB Connection String MONGODB_URI=mongodb://localhost:27017/hotel # JWT Secret Key JWT_SECRET=your_secret_key
-
Save the
.env
file. -
Start the application:
yarn start
The server should now be running on
http://localhost:5000
.
POST /auth/register
: Register a new user.POST /auth/login
: Authenticate user and generate a JSON Web Token (JWT).
GET /room/live/rooms
: Retrieve all available rooms.POST /room/add/room
: Create a new room.
GET /book/live
: Retrieve active bookings for the authenticated user.POST /book/book
: Create a new booking for the authenticated user.GET /book/yourbookings
: Retrieve all bookings for the authenticated user.
Please refer to the API documentation or code files for detailed request and response information for each endpoint.
Contributions to the project are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
- Fork the repository.
- Create your feature branch:
git checkout -b feature/my-feature
. - Commit your changes:
git commit -am 'Add my feature'
. - Push to the branch:
git push origin feature/my-feature
. - Open a pull request.
This project is licensed under the MIT License. Feel free to use and modify the code according to your needs.