npm run dev - starts the server
npm run seed - seeds Database
npm run test - run Jest tests
PORT=9999
STATUS=dev (or "production" to use MONGO_PRODUCTION)
MONGO=mongodb://localhost:27017/javarewards_test ( locally hosted mongoDB)
MONGO_PRODUCTION ( mongoGB uri)
STRIPE_PRIV (stripe private key)
STRIPE_PUB (stripe public key)
- GET - responds with users object with array of all users
- POST -
{ name, age: number, email, avatar_url}
-
- GET - responds with user by given user_id
-
- POST -
{ email }
- responds with user by given email - PATCH -
{ email , age: ...}
- updates shop by given email - DELETE -
{ email }
- deletes user
- POST -
-
- PATCH -
{ email }
- updates coffee count by 1
- PATCH -
- GET - responds with shops object with array of all coffee shops
- POST -
{ name, email, lat , long, description , avatar_url}
-
- GET - responds with shop by given shop_id
-
- POST -
{ email }
- responds with shop by given email - PATCH -
{ email : , description: ...}
- updates shop by given email - DELETE -
{ email }
- deletes shop
- POST -
-
- PATCH -
{ email , menu: [ { item, cost,description, item_img } ,...] }
- PATCH -
-
- GET - responds with array of offers from all shops
- PATCH -
{ email , offers: { img, description, date }}
- updates shop's offer by given email
-
- PATCH -
{email, rating }
- updates rating of given shop
- PATCH -
- GET - responds with orders object with array of all orders
- can filter by shop_id, user_id , year and month
/orders?shop_id=1
/orders?shop_id=1&year=2023&month=12
- can filter by shop_id, user_id , year and month
- POST - inserts or updates order | Request Body:
{ user_email, shop_email, items[item_name,quantity, price] }
-
- PATCH - updates status by order order_id
{ order_id }
- PATCH - updates status by order order_id
-
- GET - responds with sum of all items for given shop_id
- Generates n random orders for random shop_id / user_id and date range and saves it on random_orders.json