Skip to content

A private repository made to manage the progress/development of RecipeAPI. The assignment is utilizing Python to build a RESTful API

Notifications You must be signed in to change notification settings

Soban-Farhan/BackendTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backend Developer Test

This is really simple (not simple) REST API made for a Backend Developer Assingnment

Note: Making this Repo public as it maybe useful for some to study or even reference.

What to do?

Currently the project is only setup to use python virtualenv. Please follow all the instructions carefully:

Setup Virtualenv method

  1. Please download Python 3.10.4 from here
  2. Please follow all instruction from Python venv: How To Create, Activate, Deactivate, And Delete
  3. Activate your newly create env and run the following command
Note: Don't need the stuff above as I'm built different. The code utilizes all liberaries available in python v3.10.4.
  1. Run the following command to setup the Recipe and Recipe Rating table with mockdata avaiable in db folder. The program will create a sqllite3 file in the same folder for database crud opertions
python db_table_creation.py
  • These command will also work on your root environments but, I highly recommend using a virtual environment.
  1. Project consists of static urls mentioned in the assignments file.
Recipes
Name Method URL Protected
List GET /recipes
Create POST /recipes
Get GET /recipes/{id}
Update PUT/PATCH /recipes/{id}
Delete DELETE /recipes/{id}
Rate POST /recipes/{id}/rating
  1. For any Protected request, please use the provided credentials as the program uses some hard coded values. For postman, enter the following values into Basic auth section.
username: test
password: password

If you want to change these credetials. Go to servers folder and open default_user.py file. Find basic_auth_token() function end of the servers.default_user.py and change username and password too

  1. The program should run and we should be good for grading the assignment.

Postman url and body examples

LIST:

URL: `http://localhost:5000/recipes`

CREATE:

URL: `http://localhost:5000/recipes`
Body:
{
    "name": "Crab and chickpea vindaloo",
    "pre_time": 6860,
    "difficulty": 3,
    "vegetarian": false
}
Authentication: Required

GET:

URL: `http://localhost:5000/recipes/{id}`

UPDATE:

URL: `http://localhost:5000/recipes/{id}`
Body:
{
    "name": "Crab and Mashed potatoes",
    "pre_time": 8034,
    "difficulty": 2,
    "vegetarian": false
}
Authentication: Required

DELETE:

URL: `http://localhost:5000/recipes/{id}`
Authentication: Required

RATE:

URL: `http://localhost:5000/recipes/{id}/rating`
Body:
{
    "recipe_id": 15,
    "rating": 5
}

About

A private repository made to manage the progress/development of RecipeAPI. The assignment is utilizing Python to build a RESTful API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages