Giter VIP home page Giter VIP logo

order-pizza-api's Introduction

logo

Order Pizza API

A RESTful API as pizza restaurant ordering system.

Setup

  1. git clone https://github.com/NavGitGood/order-pizza-api.git
  2. cd order-pizza-api
  3. pip install -r requirements.txt or place virtual environment and then install
  4. python server.py

Usage

Example Response

curl -s https://order-pizza-api-python3-7.herokuapp.com/api/orders
[
  {
    "Crust": "NORMAL",
    "Flavor": "VEGGI",
    "Order_ID": 1,
    "Size": "M",
    "Table_No": 1,
    "Timestamp": "2018-12-12T13:42:13.704148+00:00"
  },
  {
    "Crust": "THIN",
    "Flavor": "CHEESE",
    "Order_ID": 2,
    "Size": "S",
    "Table_No": 5,
    "Timestamp": "2018-12-12T13:42:13.704148+00:00"
  },
  {
    "Crust": "NORMAL",
    "Flavor": "CHICKEN-FAJITA",
    "Order_ID": 3,
    "Size": "L",
    "Table_No": 3,
    "Timestamp": "2018-12-12T13:42:13.720690+00:00"
  }
]

Endpoints

  • POST : /auth
  curl -X POST -H "Content-Type: application/json" -d '{"username": "test", "password": "test"}'  https://order-pizza-api-python3-7i.herokuapp.com/api/auth
  • POST : /orders (Access Token is required)
curl 
  -H "Content-Type: application/json" 
  -H "Authorization: Bearer <JWT>" 
  -X POST 
  -d  
 '{
    "Flavor": "ABC", 
    "Crust": "XYZ",
    "Size": "XL", 
    "Table_No": 9
  }' 
  https://order-pizza-api-python3-7.herokuapp.com/api/orders

Do replace the <JWT> in the above request with the token you have acquired.

  • DELETE : /orders/{Order_ID}
curl -X DELETE https://order-pizza-api-python3-7.herokuapp.com/api/orders/1

License

MIT

Make sure to add following files:

Procfile runtime.txt - to mention the python version to be used (must be supported by heroku, check from list https://devcenter.heroku.com/articles/python-support#supported-runtimes requirements.txt - package versions could sometime cause an issue (if not present in heroku, use a different version in that case) After you code is pushed to github main, use following steps:

go to https://dashboard.heroku.com/apps and create a new app e.g. basicflaskapi login to heroku cli in powershell / terminal using heroku login (for browser login) or heroku login -i (for login from powershell / terminal) add you repo to heroku heroku git:remote -a {project_name} e.g. heroku git:remote -a basicflaskapi push your code to heroku git push heroku main if everything runs fine, a url would be generated for your app

order-pizza-api's People

Contributors

navgitgood avatar imgbotapp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.