An app to manage store operations
- clone the repo locally in a terminal using
git clone https://github.com/KMaina/Store-Manager-API.git - cd into the
Store-Manager-API folder - Create a virtual environmnet using the command
virtualenv -p python3 venv - On Linux and OS X activate using
source venv/bin/activate
- On windows activate using
cd venv\Script\activate
- Set the following environment variables on Linux and OS X using
export FLASK_APP=run.py
export FLASK_ENV=development
export SECRET_KEY=verysecret #change-this!
- Set the following environment variables on Windows using
set FLASK_APP=run.py
set FLASK_ENV=development
set SECRET_KEY=verysecret #change-this!
- Install all dependencies by running
pip install -r requirements.txtwhile at the root of the directory - For unit tests and coverage run the command
coverage run --source=app -m pytest && coverage report - Once done, deactivate the virtual environment by running
deactivatein the terminal
- In Postman, add the address
127.0.0.1:5000/api/v1/auth/loginto thePOSTmethod - Add the JSON body to login into the app
{
"name":"admin",
"password":"passadmin"
}
- In Postman, add the address
127.0.0.1:5000/api/v1/auth/signupto thePOSTmethod - Add a JSON body to register into the app and grab the token from the login.
{
"name":"Ken Maina",
"password":"mysecret",
"confirm":"mysecret"
}
- To add a product, add
127.0.0.1:5000/api/v1/productsto thePOSTmethod - Use the following JSON body
{
"name":"eggs",
"quantity":50,
"price":20,
"reorder":10
}
- To edit a product, add
127.0.0.1:5000/api/v1/products/<int:productId>to thePUTmethod
{
"name":"eggs",
"quantity":50,
"price":20,
"reorder":10
}
- To delete a product, add
127.0.0.1:5000/api/v1/products/<int:productId>to theDELETEmethod - To create a product, add
127.0.0.1:5000/api/v1/salesto thePOSTmethod - Use the following JSON body
{
"name":"eggs",
"quantity":50
}
- Version 2 - Store Manager API with database persistence using POSTGREsql
- Version 1 - Store Manager API with memory persistence
Ken Maina - maina.ken0@gmail.com https://github.com/KMaina
- Fork it (https://github.com/Kmaina/Store-Manager-API/fork)
- Create your feature branch (git checkout -b feature/fooBar)
- Commit your changes (git commit -am 'Add some fooBar')
- Push to the branch (git push origin feature/fooBar)
- Create a new Pull Request