This is a simple eCommerce backend application built with Node.js, Express.js, and MongoDB. The backend provides RESTful API endpoints for managing products, orders, and customers. It also includes authentication and authorization mechanisms to secure the API endpoints.
- Node.js (version 10 or later)
- MongoDB (version 3.6 or later)
- Clone the repository:
git clone https://github.com/your-username/simple-ecommerce-backend.git
- Install dependencies:
cd simple-ecommerce-backend
npm install
- Configure environment variables:
Create a .env
file in the root directory of the project and add the following environment variables:
PORT=3000
MONGODB_URI=mongodb://localhost:27017/ecommerce
JWT_SECRET=your-jwt-secret
- Start the server:
npm start
Create a new user account.
Request Body:
{
"name": "John Doe",
"email": "john@example.com",
"password": "password"
}
Authenticate a user and generate a JWT token.
Request Body:
{
"email": "john@example.com",
"password": "password"
}