Skip to content

Back-End Repository of the Support Local App, THE one-stop shop for all things local. It compiles all local businesses, and services in an easy-to-use portal and allows them to offer their products and services to customers through the platform.

License

Notifications You must be signed in to change notification settings

xavierkoo/support-local-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nobackgroundlogo

Support Local

Support Local is THE one-stop shop for all things local. It compiles all local businesses, and services in an easy-to-use portal and allows them to offer their products and services to customers through the platform.

General Info

This is the backend repository for the Support Local web application built upon Node.js with RESTful APIs developed using Express. Data for the application is stored on MongoDB. Integration tests are written with Jest.

Main App Link: https://support-local-frontend.onrender.com/

Frontend Repository: https://github.com/xavierkoo/support-local-frontend

Backend Tech Stack

  • Express
  • Node.js
  • MongoDB
  • Jest

Project setup

Download project repository to your local directory:

git clone git@github.com:xavierkoo/support-local-backend.git

Open your terminal in the local project root folder, and execute:

npm install

Add .env file and configure database connection

MONGODB_URI=mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
PORT=3001

Compiles and hot-reloads for development

npm run dev

Lints and fixes files

npm run lint

You may make API calls to the server locally via localhost:3001.

Database Entity-Relationship Diagram

Screenshot 2022-11-10 at 8 58 20 AM

API Documentation

Base API URL

https://support-local-backend.onrender.com/api

User Related APIs

Merchants

Get all merchants

GET: /merchants
Send: NIL
Receive: All Merchant Objects || Response Code - 404

Get specific merchant

GET: /merchants/:id
Send: merchantId (ObjectId)
Receive: Specific Merchant Object || Response Code - 404

Update merchant products

PATCH: /merchants/:id
Send: merchantId (ObjectId), productId (ObjectId Array)
Receive: Updated Merchant Object, Response Code - 204 || Exception

Orders

Get all orders

GET: /orders
Send: NIL
Receive: All Order Objects || Response Code - 404

Get specific order

GET: /orders/:id
Send: orderId (ObjectId)
Receive: Specific Order Object || Response Code - 404

Add new order

POST: /orders
Send: user (ObjectId), orderDate (String), orderStatus (String), products (ObjectId Array), deliveryDate (String)
Receive: New Order Object Response Code - 201 || Exception

Update order status

PATCH: /orders/:id
Send: orderStatus (String)
Receive: Updated Order Object, Response Code - 204 || Exception

Products

Get all products

GET: /products
Send: NIL
Receive: All Product Objects || Response Code - 404

Get specific product

GET: /products/:id
Send: productId (ObjectId)
Receive: Specific Product Object || Response Code - 404

Add new product

POST: /products
Send: name (String), price (Number), specialPrice (Number), category (String), rating (Number), imgUrl (String), numberSold (Number), productDesc (String), productSpec (String Array), merchant (ObjectId), reviews (ObjectId Array)
Receive: New Product Object, Response Code - 201 || Exception

Delete specific product

GET: /products/:id
Send: productId (ObjectId)
Receive: Specific Product Object, Response Code - 204 || Exception

Update product fields

PATCH: /products/:id
Send: name (String), price (Number), specialPrice (Number), category (String), rating (Number), imgUrl (String), numberSold (Number), productDesc (String), productSpec (String Array), merchant (ObjectId), reviews (ObjectId Array)
Receive: Updated Order Object, Response Code - 204 || Exception

Update product with new review

PATCH: /products/:id
Send: reviews (ObjectId Array)
Receive: Updated Order Object, Response Code - 204 || Exception

Reviews

Get all reviews

GET: /reviews
Send: NIL
Receive: All Review Objects || Response Code - 404

Get specific review

GET: /reviews/:id
Send: reviewId (ObjectId)
Receive: Specific Review Object || Response Code - 404

Add new review

POST: /reviews
Send: user (ObjectId), product (ObjectId), rating (Number), orderDetails (String)
Receive: New Review Object, Response Code - 201 || Exception

Users

Get all users

GET: /users
Send: NIL
Receive: All User Objects || Response Code - 404

Get specific user

GET: /users/:id
Send: userId (ObjectId)
Receive: Specific User Object || Response Code - 404

Add new user

POST: /users
Send: email (String), password (String), profImageUrl (String), reviews (ObjectId Array), orderDetails (ObjectId Array)
Receive: New User Object, Response Code - 201 || Exception

Update user with new order

PATCH: /users/:id
Send: orderDetails (ObjectId Array)
Receive: Updated User Object, Response Code - 204 || Exception

Update user with new review

PATCH: /users/:id
Send: reviews (ObjectId Array)
Receive: Updated User Object, Response Code - 204 || Exception

About

Back-End Repository of the Support Local App, THE one-stop shop for all things local. It compiles all local businesses, and services in an easy-to-use portal and allows them to offer their products and services to customers through the platform.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published