This is a Node.js application that provides endpoints for managing carts, categories, orders, products, and users. This README file provides information on setting up the project and configuring the database.
Before you begin, ensure you have the following installed:
- Node.js
- PostgreSQL
- Clone the repository:
git clone <repository-url>
- Install dependencies:
cd triveous-api npm install
- Create a PostgreSQL database for the project.
- Create the .env file and add the below attribute to this file (You can set your own attributes)
PORT=3000 DB_HOST="localhost" DB_PORT=5432 DB_NAME="triveous" DB_USER="postgres" DB_PASS="root"
- Run migrations to create database tables:
npm run migration:up
Swagger Url: http://localhost:3000/api-docs/
Base API Url: http://localhost:3000/api/v1/triveous/
POST
/users - Create a new user
PUT
/users - Edit user information
POST
/users/login - User login
POST
/category - Add a parent category
GET
/category - Get all categories
POST
/category/sub-category - Add a sub-category
GET
/products - Get all products
POST
/products - Add a new product
GET
/products/{id} Get a product by ID
PUT
/products/{id} - Edit a product by ID
GET
/products/category/{name} - Get products by category name
POST
/cart - Add a product to the cart
PUT
/cart - Remove a product from the cart
DELETE
/cart - Empty the cart
GET
/cart - Get cart items for the authenticated user
POST
/orders/{cart_id} - Place a new order using the specified cart ID
GET
/orders - Get all orders for the authenticated user
GET
/orders/{order_id} - Get details of a specific order by order ID
- Cart: Cart management
- Category: Category management
- Orders: Order management
- Products: Product management
For any inquiries, contact: Name: Krishna Viramgama Email: [email protected]