- these commands below for now are for macos users only
- the package manager here is Pip, but you may want to use: Pipenv, Poetry or Conda
This is just practice in making a simple Restful API using Python Flask with the CRUD HTTP methods for
- fetching and displaying all books in DB
- fetching a specific book based on ID (for now)
- Adding a new book to the DB
- Amending details of an existing book
- Deleting a book
- make sure you have Python3+, if not download from https://www.python.org/downloads/
- create virtual env to host this API:
% python3 -m venv <name of virtual env>
%
- activate virtual env
% source ./bin/activate
(<name of virtual env>) -> %
- cd into that venv directory
- clone repository from this github page
- install dependencies via requirements.txt
(<name of virtual env>) -> % pip install -r requirements.txt
- make sure to manually test by having a rest client installed e.g. postman: https://www.postman.com/downloads/
Data is stored and persisted in ./instance/database.db
(<name of virtual env>) -> % python create_db.py
NOTE: To delete the DB it will have to be done manually
(<name of virtual env>) -> % rm ./instance/database.db
(<name of virtual env>) -> % python main.py
main.py contains the entry for running api.py, but you may want to run it in a different way e.g. from the IDE