Skip to content

harunkleoglu/mpc-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backend API - Product Service

Tech Stack

  • Node.js + TypeScript
  • Express.js (REST API)
  • Prisma ORM (database access)
  • PostgreSQL (Supabase) as database

How to Run

  1. Clone the repo

    npm install
  2. Add .env content.

    • DATABASE_URL and CORS_ORIGIN
  3. Run development script

    npm run dev
  4. Build for prod env and run.

    npm run build 
    npm start

API Endpoints

  • GET /products → List all products. (optional query: ?category=Apparel)
  • GET /products/:id → Get product by id.
  • POST /products → Add new product.

Sample Requests

List

curl http://localhost:3000/products

Get Single Product

curl http://localhost:3000/products/1

Add New Product

curl -X POST http://localhost:3000/products \
-H "Content-Type: application/json" \
-d '{
    "name": "Basic T-Shirt",
    "description": "Cotton, slim fit",
    "quantity": 50,
    "price": 19.99,
    "category": "Apparel",
    "imageUrl": "https://picsum.photos/seed/tee/400/300",
    "inStock": true
}'    

About

mpc-backend service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published