Backend code for resturant booking application.
Request should be in JSON format with Bearer token in header of request.
Response will be in JSON format.
Server: Node, Express
Database PostgreSQL
To install Node.js
https://nodejs.org/en/download
To install PostgreSQL
https://www.postgresql.org/download/
POST /auth/register
Parameter | Type | Description |
---|---|---|
name |
string |
Required. Name of the user. |
username |
string |
Required. Unique username for each user. |
email |
string |
Required. Unique email for each user. |
password |
string |
Required. Password for user authentication. |
user_type |
string |
Required. Type of user. "customer" or "staff" |
contact_info |
string |
Optional. Contact Information of user. |
role |
string |
Optional. Role of user if Staff. |
POST /auth/login
Parameter | Type | Description |
---|---|---|
username |
string |
Required. username of user. |
password |
string |
Required. User password. |
POST /staff/updateRoom
Parameter | Type | Description |
---|---|---|
room_id |
Number |
Required. Room ID of "Room" table. |
isAvailable |
Boolean |
Optional. Default True. Boolean value for availability. |
avail_date |
Date |
Required. Date on which room is available. |
POST /customer/search-rooms
Parameter | Type | Description |
---|---|---|
capacity |
Number |
Optional. Minimum required capacity. |
date |
Date |
Optional. Date on which room is required. |
POST /customer/bookRoom
Parameter | Type | Description |
---|---|---|
avail_id |
Number |
Required. avail_id of 'Room_Availability' table. |
git clone https://github.com/eklavyabhargava/resturant-management-system.git
cd restaurants-management-system
Using npm
npm install
Using yarn
yarn install
Run query in database shell to create database:
CREATE DATABASE <database_name>
Run Script file in cmd:
psql -U your_username -h your_host -d your_database script.sql
Insert sample data, run command:
psql -U your_username -h your_host -d your_database sample_data.sql
Key | Value |
---|---|
DB_USER |
<your_username> |
DB_HOST |
<db_hosted_on> |
DB_NAME |
<db_name> |
DB_PASSWORD |
<yourdb_password> |
DB_PORT |
<yourdb_port> |
PORT |
Port on which server run |
Using node
node server
Using nodemon
nodemon server