This is a Node.js E-Commerce API with user authentication using JSON Web Tokens (JWT), cart management, and order placement functionality.
Please follow these steps to access authorized routes:
- Register the user and then log in using the same email and password.
- Upon successful login, you will receive a token. Copy this token.
- Click on the 'Authorize' button and paste the copied token into the provided field.
- Now you can access all the authorized routes.
- Node.js and npm installed on your system
- MongoDB database
- Clone the repository:
git clone https://github.com/VPS07/node-ecommerce-api.git- Navigate to the project directory:
cd node-ecommerce-api- Install dependencies:
npm install- Set up environment variables:
Create a .env file in the project root and add the following variables:
PORT=3000
DB_URL=mongodb://localhost:27017/your_database_name
JWT_SECRET=your-secret-keyReplace your_database_name with your MongoDB database name and your-secret-key with your desired secret key for JWT encryption.
- Start the server:
npm start- Access the API at
http://localhost:3000.
To access swagger documentation visit at http://localhost:3000/api-docs/