A backend built for an Food Ecommerce Store, Zuck.
- ⚡ 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.
- Clone this repo using
https://github.com/sushilburagute/zuck-backend.git
- Move yourself to the appropriate directory
- Run
yarn
to install dependencies - Run the development server:
npm run dev
# or
yarn dev
Open http://localhost:5000 with your browser to see the result.
This project is licensed under the MIT License - see the LICENSE page for details.
Sushil Buragute - Twitter - Linkedin - Portfolio
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>
Here's the documentation on how to use the API.
*means that endpoint needs 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.
GET /
: Route to fetch all data regarding the food dishes.
GET /:id
Route to fetch the data on a specific dish.
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"
}
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"
}
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."
}