-
Notifications
You must be signed in to change notification settings - Fork 599
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
4,069 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
node_modules/ | ||
dist/ | ||
vendor/ | ||
cache/ | ||
.*/ | ||
*.min.* | ||
*.test.* | ||
*.spec.* | ||
*.bundle.* | ||
*.bundle-min.* | ||
*.log |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Licensing Page</title> | ||
|
||
<style> | ||
body { | ||
font-family: 'Lato', sans-serif; | ||
background: linear-gradient(to bottom, #080f21, #06255b); | ||
color: #ffffff; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.container { | ||
max-width: 70%; | ||
margin: 50px auto; | ||
padding: 20px; | ||
border-radius: 10px; | ||
} | ||
|
||
.container .title { | ||
font-size: 4.3em; | ||
color: #13b8e6; | ||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | ||
margin-bottom: 20px; | ||
font-weight: 700; | ||
text-align: center; | ||
} | ||
|
||
.container .section-title { | ||
text-align: left; | ||
font-size: 2em; | ||
color: #0dcaf0; | ||
margin-top: 20px; | ||
} | ||
|
||
.container .license-text { | ||
font-size: 1.2em; | ||
line-height: 1.6; | ||
color: #f0f0f0; | ||
margin-bottom: 20px; | ||
text-align: left; | ||
} | ||
|
||
.container hr { | ||
width: 50%; | ||
color: #d56fa1; | ||
opacity: 0.3; | ||
margin: 20px auto; | ||
} | ||
|
||
@media (max-width: 768px) { | ||
.container .title { | ||
font-size: 2em; | ||
} | ||
|
||
.container .section-title { | ||
font-size: 1.5em; | ||
} | ||
|
||
.container .license-text { | ||
font-size: 1em; | ||
} | ||
} | ||
|
||
.copyright-footer { | ||
display: flex; | ||
justify-content: center; | ||
margin-top: 25px; | ||
font-size: 17px; | ||
color: rgb(185, 185, 185); | ||
} | ||
|
||
</style> | ||
</head> | ||
<body> | ||
<a href="index.html"> | ||
<img src="./img/Screenshot 2024-01-23 003448.png" style="width: 130px; border-radius: 6px; margin-top: 20px; margin-left: 20px;"> | ||
</a> | ||
<div class="container"> | ||
<h1 class="title">Licensing Page</h1> | ||
<div class="license-text"> | ||
<h2 class="section-title">MIT License</h2> | ||
<p>Copyright (c) 2023 Arpan Chowdhury</p> | ||
<p>Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions:</p> | ||
<p>The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software.</p> | ||
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE.</p> | ||
</div> | ||
<hr> | ||
<footer class="copyright-footer"> | ||
<p>© 2023 Arpan Chowdhury. All rights reserved.</p> | ||
</footer> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Thank You</title> | ||
<style> | ||
body { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
font-family: Arial, sans-serif; | ||
background-color: #f4f4f4; | ||
} | ||
.container { | ||
text-align: center; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Thank You</h1> | ||
<img src="./t.png" alt="Thank"> | ||
</div> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules/ | ||
.env | ||
combined.log | ||
src/config/config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
## Backend Module - Travel Booking API | ||
|
||
This is the backend module for a travel booking API. It utilizes MongoDB for data storage and Express.js for server-side development. | ||
|
||
### Environment Variables | ||
|
||
The following environment variables are required and should be defined in a `.env` file: | ||
|
||
* `PORT`: The port on which the server will listen (default: 5000) | ||
* `DATABASE_URL`: The MongoDB connection string | ||
* `JWT_SECRET_KEY`: The secret key used for signing JSON Web Tokens (JWT) | ||
* `TOKEN_EXP`: The expiration time for JWTs (e.g., "1h" for 1 hour) | ||
|
||
**Example .env file:** | ||
|
||
``` | ||
PORT=5000 | ||
DATABASE_URL="mongodb+srv://username:[email protected]/?appName=Cluster0" | ||
JWT_SECRET_KEY="authorizationAndAuthentication" | ||
TOKEN_EXP="1h" | ||
``` | ||
|
||
**How to create a `.env` file:** | ||
|
||
1. Create a file named `.env` in the root directory of your project. | ||
2. Add the environment variables as key-value pairs on separate lines. | ||
3. **Do not** commit the `.env` file to your version control system (e.g., Git). | ||
|
||
### Dependencies | ||
|
||
This project uses the following dependencies: | ||
|
||
* express: Web framework for building server-side applications | ||
* mongoose: Object Document Mapper (ODM) for MongoDB | ||
* http-status-codes: Provides convenient HTTP status code handling | ||
* bcryptjs: Password hashing library | ||
* jsonwebtoken: Library for generating and verifying JWTs | ||
|
||
**Installation:** | ||
|
||
```bash | ||
cd backend | ||
npm install | ||
``` | ||
|
||
### Starting the Server | ||
|
||
Start the development server with the following command: | ||
|
||
```bash | ||
npm run dev | ||
``` | ||
|
||
This will start the server on the port specified in the `PORT` environment variable (default: 5000). | ||
|
||
### API Endpoints | ||
|
||
Here's a breakdown of the API endpoints available in this module: | ||
|
||
**1. Locations Routes (`/locations`):** | ||
|
||
* **GET /locations** (Public): Retrieves all locations from the database. | ||
* **GET /locations/:id** (Public): Retrieves a specific location by its ID. | ||
* **POST /locations/create** (**Authorization Required - Admin Role**): Creates a new location. Requires the following request body: | ||
* `img` (String): URL of the location image. | ||
* `locationName` (String): Name of the location. | ||
* `locationMapLink` (String): Link to the location on a map service. | ||
* `price` (Number): Price per night for the location. | ||
* `rating` (Number): Average rating of the location (optional). | ||
* `description` (String): Description of the location (optional). | ||
* `climateInfo` (String): Information about the location's climate (optional). | ||
* `transportationType` (Array of Strings): Types of transportation available to reach the location (optional). | ||
* `thingsToDo` (Array of Strings): Things to do around the location (optional). | ||
* **PUT /locations/:id** (**Authorization Required - Admin Role**): Updates an existing location by its ID. Requires the same request body format as `POST /locations/create`. | ||
* **DELETE /locations/:id** (**Authorization Required - Admin Role**): Deletes a location by its ID. | ||
|
||
**2. User Routes (`/auth`):** | ||
|
||
* **POST /auth/signup** (Public): Creates a new user account. Requires the following request body: | ||
* `name` (String): User's full name. | ||
* `email` (String): User's email address. | ||
* `password` (String): User's password. | ||
* `role` (String - optional): User's role (default: "Customer"). Can be "Admin" for admin users. | ||
* **POST /auth/login** (Public): Logs a user in and returns an access token. Requires the following request body: | ||
* `email` (String): User's email address. | ||
* `password` (String): User's password. | ||
* **GET /auth/logout** (**Authorization Required**): Logs the currently authenticated user out. | ||
|
||
**3. Trip Booking Routes (`/trip`):** | ||
|
||
* **POST /trip/book** (**Authorization Required**): Books a location for the currently authenticated user. Requires the following request body: | ||
* `id` (String): ID of the location to be booked. | ||
* `checkin` (Date): Check-in date |
Oops, something went wrong.