This E-Commerce Web Service allows users to:
- Create an account
- Login and obtain an access token
- Create, view, and update a store
- Create, view, and update products for a store
- Add products to a cart with specified quantities
- Checkout items in the cart
Before you begin, ensure that you have the following installed:
- Node.js (version 14.x or later)
- npm (Node package manager)
-
Clone the repository:
git clone <repository-url> cd <project-folder>
-
Create an environment configuration:
- Copy the
.env.examplefile to.env:cp .env.example .env
- Open the
.envfile and replace the values with your environment-specific configurations (such as database URI, JWT secret, etc.).
- Copy the
-
Install dependencies:
- Run the following command to install required packages:
npm install
- Run the following command to install required packages:
-
Run the application in development mode:
- Start the server with the following command:
npm run start:dev
- The application will be running on
http://localhost:3000.
- Start the server with the following command:
-
Access the API Documentation:
- Open your web browser and visit the following URL to view the API documentation:
http://localhost:3000/docs
- Open your web browser and visit the following URL to view the API documentation:
Refer to the API documentation for detailed information about available endpoints and their usage. The documentation will provide you with the necessary details to interact with the service, including the request body, parameters, and response format.
-
Authentication: You can log in to the application using your credentials, which will return an access token. This token should be used to authenticate subsequent API requests by including it in the
Authorizationheader asBearer <token>. -
Database: The application connects to a MongoDB database specified in the
.envfile. Make sure your database service is up and running.
- The application is designed to handle typical e-commerce operations such as managing products, stores, and carts. It also supports basic authentication using JWT tokens.
- Ensure you review and set proper environment variables in the
.envfile before running the app.
By following the steps above, you should be able to set up and run the e-commerce web service locally for development purposes. For production deployments, additional configurations may be necessary, such as configuring a production database, enabling SSL, or setting up environment-specific variables.