Skip to content

gonzdome/OrderManagerAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Packages


Express: To run the server

npm i express

Nodemon: Restart automatically the server on save

npm i -d nodemon

Sequelize/Sequelize-CLI: To deal with the Models/Migrations

npm i sequelize
npm i --save-dev sequelize-cli`

PG/ PG-HSTORE: Postgres drivers for Sequelize

npm i --save pg pg-hstore

Jest: for TDD

npm i --save-dev jest

Sequelize-Mock: To mock Sequelize on tests

npm i --save-dev sequelize-mock

package.json scripts:

run: "nodemon --inspect src/server.js",
run-migrations: "npx sequelize-cli db:migrate",
undo-migrations: "npx sequelize-cli db:migrate:undo",
undo-all-migrations: "npx sequelize-cli db:migrate:undo:all",
run-seeds: "npx sequelize-cli db:seed:all",
undo-all-seeds: "npx sequelize-cli db:seed:undo:all",
test: "jest --forceExit --detectOpenHandles"

Run to create and populate db: run-migrations and run-seeds

Run to execute tests: run-migrations and run-seeds to create and populate db


Methods

  • Customer Registration:

  • body:
{
    "name" : "Random2",
    "email" : "Random2@test.com",
    "phone" : "14997654812"
}
  • Adding Dishes to the Menu:

  • body:
{
    "name": "Menu_Test",
    "description": "Test description",
    "price": 2250,
    "category": "main_course"
}
  • List the Menu:

url: http://localhost:3000/menu?page=0&limit=3 (to search cathegory add: &category=dessert)

  • Create an Order:

  • body:
{
    "customer_id": 1,
    "items": [
        {
            "menu_item_id": 1,
            "quantity": 1
        },
        {
            "menu_item_id": 2,
            "quantity": 1
        }
    ]
}
  • List Orders by Customer with pagination:

  • Update Order Status:

  • body:
{
    "status": "preparing"
}
  • Modify an Order:

  • body:
{
    "items": [
        {
            "menu_item_id": 1,
            "quantity": 10
        }
    ]
}

About

API to manage a restaurant's orders using Node.js and JavaScript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published