Skip to content

geofrocker/rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yummy-Recipes Restful API

Build Status Coverage Status Requirements Status

Description

Yummy recipies API is an api built using restframework

  • A user can see the available recipes
  • A user can register for membership
  • A user can login using his/her credentials
  • A user can add, edit and delete recipes

Installation guide

  • This application has been tested with Python 3.4 and Flask 0.11
  • Make sure the above requirements are satisfied
  • Navigate to the project root directory and run pip install -r requirements.txt from command line. Learn more about pip if you don't have it already installed
  • Create a .env file in the root directory and fill it with the lines below.
  • Run python app.py from command line or terminal
  • You should be able to see something similar to this A screen shot of flask running in cmd
  • Visit your browser and enter 127.0.0.1/5000
  • 💥💥 You will be good to go
  • You can access the documentation from here

Initialize the databases and create tables

$ python manage.py db init
$ python manage.py db migrate
$ python manage.py db upgrade

Create a .env file and add the following variables

  • DEBUG = True
  • DATABASE_URL = 'postgresql://localhost/rest_api'
  • TEST_DB = 'postgresql://localhost/ApiTests'
  • SQLALCHEMY_TRACK_MODIFICATIONS = False
  • SECRET_KEY = '\xfd{H\xe5<\x95\xf9\xe3\x96.5\xd1\x01O<!\xd5\xa2\xa0\x9fR"\xa1\xa8'

How run tests

  • Make sure all the requirements are installed by running pip install -r requirements.txt
  • Make sure you are in the projects root directory
  • Open your terminal and run py.test test/tests.py
  • Or PYTHON_PATH=. pytest test/tests.py -r Pf --cov=.
  • To install nose use:sudo pip install nose
  • Then just use:nosetests --with-coverage --cover-package=recipes
  • You will be good to go 💥💥

For Testing purposes

  • I recommend that you install Postman from here
  • This will help you to test the api efficiently. click here to get started
EndPoint Functionality
POST /auth/login Logs a user in and generates a unique token
POST /auth/register Register a user
POST / Create a new recipe
GET / Get all the public recipes
GET /<recipe_id> Get single recipe
PUT /<recipe_id> Update a specific recipe
DELETE /<recipe_id> Delete a specific recipe
GET /users Get all users
GET /users/<user_id> Get user by id
DELETE /users/<user_id> Delete a user by id

Releases

No releases published

Packages

No packages published

Languages