Skip to content

Backend for a clone of a food delivery app built in expressJS and typescript.

License

Notifications You must be signed in to change notification settings

sushilburagute/zuck-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


dapr

Zuck Backend

A backend built for an Food Ecommerce Store, Zuck.


Built With

  • NodeJS — JavaScript runtime built on Chrome's V8 JavaScript engine.
  • ExpressJS - Fast, unopinionated, minimalist web framework for node.
  • Typescript — TypeScript is a language for application-scale JavaScript.
  • Mongoose — Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment.
  • JSONwebtoken — An implementation of JSON Web Tokens.

Getting started

  1. Clone this repo using https://github.com/sushilburagute/zuck-backend.git
  2. Move yourself to the appropriate directory
  3. Run yarn to install dependencies
  4. Run the development server:
npm run dev
# or
yarn dev

Open http://localhost:5000 with your browser to see the result.

License

This project is licensed under the MIT License - see the LICENSE page for details.


Author

Sushil Buragute - Twitter - Linkedin - Portfolio




API Documentation

.env Config

PORT=5000
DB_LOCAL=<your mongodb local url>
DB_ATLAS=<your hosted mongodb url>
JWT_SECRET=<secret string to generate jwt>
JWT_EXPIRES_IN=<time for the jwt to expire>

API Endpoints

Here's the documentation on how to use the API.

*means that endpoint needs Auth.

/api/auth :

POST /sign-up: Route to Sign up.

{
  "firstName": "John",
  "lastName": "Doh",
  "email": "[email protected]",
  "password": "Test12345!"
}

POST /sign-in: Route to sign in.

{
  "email": "[email protected]",
  "password": "Test12345!"
}

POST /logout: Route to logout.

GET* /user-info`: Route to gather user email.

/api/food :

GET /: Route to fetch all data regarding the food dishes. GET /:id Route to fetch the data on a specific dish.

/api/user/cart/ :

GET* /cart: Route to view the user's cart data. POST* /cart: Route to post the user's cart data.

{
  "_id": "621cd2d85011592138892e7f",
  "type": "ADD_TO_CART",
  "quantity": 4
}
{
  "quantity": 1,
  "_id": "621cd1835011592138892e76",
  "type": "REMOVE_FROM_CART"
}
{
  "quantity": 3,
  "_id": "621cd19f5011592138892e79",
  "type": "ADD_QUANTITY_IN_CART"
}
{
  "quantity": 2,
  "_id": "621cd19f5011592138892e79",
  "type": "SUBTRACT_QUANTITY_IN_CART"
}

/api/user/favourites/ :

GET* /favourites :Route to view user's fav data. POST* /favourites :Route to update user's fav data.

{
  "_id": "621cd1835011592138892e76",
  "type": "ADD_TO_FAVOURITES"
}
{
  "_id": "621cd1835011592138892e76",
  "type": "REMOVE_FROM_FAVOURITES"
}

/api/admin/seed :

POST /seed : Route to seed data.

{
	"name": "Pizza",
	"deliveryTime": 40,
	"price": 240,
	"discount": 9,
	"rating": 4.3,
	"veg": true,
	"type": "MAIN_COURSE",
	"image": "https://res.cloudinary.com/dus8fi5oj/image/upload/v1646053243/zuck-food/pizza_kqy2tq.jpg",
	"description": "But the pizza we all know today, made with tomato sauce, cheese, and numerous toppings, originated in Italy. It became popular in Naples in the 18th century as a cheap, nourishing food that was consumed mainly by peasants. The modern pizza as we know it today evolved from early Neapolitan flatbreads topped with lard, salt, and garlic."
}

About

Backend for a clone of a food delivery app built in expressJS and typescript.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published