This repository contains the backend and frontend code for the Book Selling E-commerce Platform project. It is built with Node.js and Express.js.
- Clone the repository:
git clone https://github.com/sawnjordan/fullstack-assignment.git - Navigate to backend project directory:
cd fullstack-assignment/backend - Install the dependencies:
npm install
- Create a
.envfile in the./backenddirectory of the project. - Define the following environment variables in the
.envfile:
MONGODB_URL=mongodb://127.0.0.1:27017/ MONGODB_DB=bookecommerce
JWT_SECRET_KEY=secret-key-ecommmerce JWT_EXPIRES_IN=7d
COOKIE_EXPIRES_IN=7
Adjust the values as per your requirements.
- Start the server:
npm start - The server will be running at
http://localhost:5000
The following API endpoints are available:
-
POST /api/v1/register: Register a users. -
POST /api/v1/login: Login a user. -
GET /api/v1/logout: Logout a user. -
GET /api/v1/books/: Get All Books -
POST /api/v1/books/new: Create New Book -
PUT /api/v1/book/:id: Update a Book -
DELETE /api/v1/book/:id: Delete a Book -
GET /api/v1/book/:id: Get a Book