This is an API version 1.0 for the recipes api called "DOOF" designed using the flask microframework in python
https://doofrecipeapi.herokuapp.com/apidocs
You should have git, python, pip, postgresql, virtualenv installed
-
Open your terminal/commandline
-
Clone the project using
git clone https://github.com/sebuliba-adrian/DoofRestfulApi
-
Change to the project directory using
cd DoofRestfulApi
-
Create a virtual environment for the project using the command
virtualenv venv
and start it usingsource venv/bin/activate
for unix orvenv\Scripts\activate
and using the commanddeactivate
to stop the virtual environment -
Install dependencies using
pip install -r requirements.txt
-
You can run tests using the command
nose2 --with-cov --coverage tests
-
To launch the application you should first apply migrations in order to create the database whose process is shown below
-
Run the application using
python run.py
-
You can access the api documentation at
http://localhost:5000/apidocs
Install postgres: brew install postgresql
-
Type psql in terminal.
-
On postgres interactive interface, type CREATE DATABASE develop_db;
-
Create a user, type; CREATE USER username WITH PASSWORD 'password'
-
Edit the /config/config.py with the created username and password from step3 above.
$ python manage.py db init
$ python manage.py db migrate
$ python manage.py db upgrade
$ python manage.py db --help
python run.py
EndPoint | Functionality | Public Access |
---|---|---|
POST /auth/login | Logs a user in | TRUE |
POST /auth/register | Register a user | TRUE |
POST /auth/logout | Logs a user out | FALSE |
POST /categories/ | Create a new category list | FALSE |
GET /categories/ | List all the created categories | FALSE |
GET /categories/<category_id> | Get single category | FALSE |
PUT /categories/<category_id> | Update this category | FALSE |
DELETE /categories/<category_id> | Delete this single category | FALSE |
POST /categories/<category_id>/recipes | Create a new recipe category | FALSE |
PUT /categories/<category_id>/recipes/<recipe_id> | Update a recipe | FALSE |
DELETE /categories/<category_id>/recipes/<recipe_id> | Delete a recipe in a category | FALSE |
GET /categories?limit= | Gets a number of categories relative to the value passed in number. Maximum records is 100 | FALSE |
GET /categories?q=<category_name> | Search for category with the same name as that passed in category_name | FALSE |
Others specs coming soon