A RESTful API for yummy recipes
- Python 3.6.*
- Postgresql 9.6.*
- Flask 0.12.*
-
Create a folder on your computer Clone repository to your computer into created folder
git clone https://github.com/code-sleuth/yummy-recipes-api.git
-
Navigate into created folder
cd yummy-recipes
-
Create and activate virtual environment.
$ virtualenv venv $ source venv/bin/activate
More on setting up Virtual environment: how to set up virtual environment
-
Install the packages in requirements.txt
pip install -r requirements.txt
-
Set up postgresql database and copy connection string for example.
DATABASE_URL='postgres://<db_user_name>:<password>@localhost/<database_name>'
and
DATABASE_URL='postgres://<db_user_name>:<password>@localhost/<test_database_name>'
How to setup postgresql: how to setup postgresql mac
-
To start the api, using terminal, run the following commands
export FLASK_APP='main_app.py'
export APP_SETTINGS='development'
export SECRET='i wont tell if you dont'
export DATABASE_URL='postgres://<db_user_name>:<password>@localhost/<database_name>'
export TEST_DB_URL='postgres://<db_user_name>:<password>@localhost/<test_database_name>
flask run
-
Using postman, the url to run the api locally is
http://127.0.0.1:5000/
. -
On the web, visit the url
https://yummy-recipes-api-pro.herokuapp.com/swagger_docs/
-
Using postman with web url
https://yummy-recipes-api-pro.herokuapp.com/
10.Sample: Use postman to navigate the endpoints in the api.
-
Register new user Web url:
https://yummy-recipes-api-pro.herokuapp.com/auth/register
Locally:
http://127.0.0.1:5000/auth/register
{ "username": "username", "fullname": "Full Name", "password": "Pass" }
-
More on the end point is availabe online via the documentation
https://yummy-recipes-api-pro.herokuapp.com/swagger_docs/
- Ibrahim Mbaziira