It is build to serve routes and data for Book Easy website
-
Seamless Mongoose Integration : Leverage the flexibility and efficiency of Mongoose for smooth database interactions, ensuring data integrity and performance.
-
Secure JWT Authentication : Implement robust JWT-based authentication to protect sensitive data and user information, guaranteeing authorized access.
-
Expressive Express-Powered API : Utilize the versatility of Express to create a well-structured and scalable REST API.
-
Clear & Informative Error Handling : Provides meaningful error messages, aiding in troubleshooting and debugging.
To test the api routes in Postman, use can use this endpoints
Base Url: https://book-easy-server.vercel.app/api
For all requests set the Content-Type in header as application/json and send data in json format
-
Authentication Rotes
These routes helps to login and register user to the website
- Register
Method: POST
Route: /auth/register
example data { "name":"dummy", "email": "[email protected]", "password": "passwordummy"}
- Login
Method: POST
Route: /auth/register
example data { "email": "[email protected]", "password":"desiredPassword" }
Set this code in Postman to automatically add token for futher routes
Open Tests and paste this code
const data = pm.response.json() pm.globals.set("accessToken", data.token)
Open Authorization and set Type to
Bearer Token
- Manipulate User
- Get User
Method: GET
Route: /user:userId
- Update User
Method: PUT
Route: /user:userId
example data { "name": "updatedName" }
- Logout User
Method: GET
Route: /user:userId
- Delete User
Method: DELETE
Route: /user:userId
Clone the repository using git clone repository-link
and install dependencies using npm install
command
Use the sample env file to know the required the envirnomental varabiles for this project
Create your own environemet varaibles
- MongoDBConnection Url
- JWT_SECRET
- RAZORPAY_KEY_ID
- RAZORPAY_KEY_SECRET