Welcome to the documentation for the BookID Server API - the backend for the BookID hotel booking website in Indonesia. This API provides a set of routes to handle user authentication, hotel bookings, photos, room reviews, rooms, and user management.
- BookID Server API - BE-2-Medan-14
To get started, clone this repository and install the dependencies using npm:
git clone <repository-url>
cd bookid_server
npm install
Make sure to set up your environment variables by creating a .env
file in the root directory. You can use the provided .env.example
as a template.
PORT = 5000
SESSION_SECRET = yourSecret
HOST = localhost/yourHost
CLIENT_URL = https://yourClientUrl
DATABASE_URL = yourDbUrl
ADMIN_NAME = yourAdminName
ADMIN_EMAIL = [email protected]
ADMIN_PASSWORD = yourAdminPassword
ADMIN_PHONE = yourAdminPhone
ADMIN_PHOTO = yourAdminPhoto
Make sure install dependencies by running this.
npm i
BookID Server uses Sequelize with MySQL. Make sure you have a MySQL server running and update your .env
file with the appropriate database configuration.
Start the server using the following command:
npm start
The server will be running at http://localhost:5000
by default. You can change the port in the .env
file.
npm start
: Starts the server.
- Endpoint:
/me
- Method:
GET
- Description: Get the details of the currently authenticated user.
- Endpoint:
/login
- Method:
POST
- Description: Log in with a registered account.
- Endpoint:
/register
- Method:
POST
- Description: Register a new user account.
- Endpoint:
/update-profile
- Method:
PATCH
- Description: Update the profile information of the currently authenticated user.
- Endpoint:
/logout
- Method:
DELETE
- Description: Log out the currently authenticated user.
- Endpoint:
/bookings
- Method:
GET
- Description: Get all bookings for the currently authenticated user.
- Endpoint:
/bookings/:id
- Method:
GET
- Description: Get details of a specific booking by ID.
- Endpoint:
/bookings
- Method:
POST
- Description: Create a new hotel booking.
- Endpoint:
/bookings/:id
- Method:
PATCH
- Description: Update details of a specific booking by ID.
- Endpoint:
/bookings/:id
- Method:
DELETE
- Description: Delete a specific booking by ID.
- Endpoint:
/photos
- Method:
GET
- Description: Get all photos.
- Endpoint:
/photos/:id
- Method:
GET
- Description: Get details of a specific photo by ID.
- Endpoint:
/photos
- Method:
POST
- Description: Create a new photo (admin only).
- Endpoint:
/photos/:id
- Method:
PATCH
- Description: Update details of a specific photo by ID (admin only).
- Endpoint:
/photos/:id
- Method:
DELETE
- Description: Delete a specific photo by ID (admin only).
- Endpoint:
/room-reviews
- Method:
GET
- Description: Get all room reviews.
- Endpoint:
/room-reviews/:id
- Method:
GET
- Description: Get details of a specific room review by ID.
- Endpoint:
/rooms
- Method:
GET
- Description: Get all rooms.
- Endpoint:
/rooms/:id
- Method:
GET
- Description: Get details of a specific room by ID.
- Endpoint:
/rooms
- Method:
POST
- Description: Create a new room (admin only).
- Endpoint:
/rooms/:id
- Method:
PATCH
- Description: Update details of a specific room by ID (admin only).
- Endpoint:
/rooms/:id
- Method:
DELETE
- Description: Delete a specific room by ID (admin only).
- Endpoint:
/users
- Method:
GET
- Description: Get all users (admin only).
- Endpoint:
/users/:id
- Method:
GET
- Description: Get details of a specific user by ID (admin only).
- Endpoint:
/users
- Method:
POST
- Description: Create a new user (admin only).
- Endpoint:
/users/:id
- Method:
PATCH
- Description: Update details of a specific user by ID (admin only).
- Endpoint:
/users/:id
- Method:
DELETE
- Description: Delete a specific user by ID (admin only).
Thank you for choosing BookID Server! We hope it makes your hotel booking app development a breeze. If you have any questions or need assistance, please refer to the API documentation or contact our support team. Happy coding!