Database to hold data the api
The app is hosted here on heroku
- Flask
- Flask_restful
- Virtualenv - A tool to create isolated virtual environment
- Pytest - python web testing frame work
Clone this repo to your local machine
- $ https://github.com/Kasulejoseph/fast-food-fast-db.git
- $ cd fast-food-fast-db
Install virtual environment
- On linux
$ virtualenv env -to create virtual environment
$ source env/bin/activate -- to activate the virtual environment
- On windows
https://programwithus.com/learn-to-code/Pip-and-virtualenv-on-Windows/
- In the virtual environment install the requirement
$ pip freeze -r requirements.txt
Install all the necessary dependencies by
$ Install PostgreSQL
$ sudo -i -u postgres
$ CREATE DATABASE food_db
$ CREATE TABLE users
$ CREATE TABLE menu
$ CREATE TABLE orders
Start the server
- $ python run.py
To run tests run this command below in your terminal
coverage run --source=. -m unittest discover
End Point | Resource Accessed | Access | Requirements |
---|---|---|---|
api/v1/auth/signup POST | Register a user | PUBLIC | username, email, password |
api/v1/auth/login POST | Login a user | PUBLIC | username, password, role |
api/v1/users/orders POST | Place an order for food. | PUBLIC | user_id, menu_id |
api/v1/users/orders GET | Get the order history for a particular user. | PUBLIC | user_id |
api/v1/orders GET | Get all orders | ADMIN | user_id, menu_id, order_id |
api/v1/orders/order_id GET | Fetch a specific order | ADMIN | order_id |
api/v1/orders/order_id PUT | Update the status of an order | ADMIN | order_id |
api/v1/menu GET | Get available menu | PUBLIC | menu_id |
api/v1/menu POST | Add a meal option to the menu. | ADMIN | menu_id |