Skip to content

A RESTFUL API for African foods, their recipes and general nutrition

Notifications You must be signed in to change notification settings

MikeRock51/african_cuisines_recipe_api

Repository files navigation

Welcome to My Api


Task

Build a backend project providing an API, document and host it on the web.

Description

African Cuisines Recipe Restful API

A RESTFUL API that provides detailed information about African cuisines. As well as step by step instructions on how to make them. The API features a GraphQL endpoint, Swagger documentation, Postman documentation and RESTFUL API endpoints.

Authentication is done using API Key for protected route.

Project Links

Installation

In the root directory of the project

  1. Install python and project dependencies and packages
$ sudo apt update
$ sudo apt install -y python3
$ sudo apt install -y python3-pip
$ sudo apt install -y python3-venv
$ sudo apt-get install -y pkg-config
$ sudo apt-get install -y libmysqlclient-dev
$ sudo apt install -y nginx
$ pip install gunicorn
$ sudo apt install redis-server
$ sudo apt install mysql-server
$ sudo systemctl start mysql.service
$ pip install -r requirements.txt
  1. Setup database
$ cat setupDatabase.sql | mysql
  1. Setup virtual environment
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
  1. Start the API servers
$ bash start_servers
  1. The RESTFUL API will be running on http://localhost:9000/api/v1/status while the graphql api on http://localhost:9000/api/v1/graphql and the swagger documentation on http://localhost:9001/api/v1/docs

Usage

  1. Create a user account POST /users
  2. Login to get your authentication token POST /login
  3. Create a recipe on POST /recipes
  4. Update a recipe on PUT /recipes/{id}
  5. Delete your recipe on DELETE /recipes/{id}
  6. Get a list of all available recipes on GET /recipes
  7. Search a recipe by querying GET /recipes?search=Plantain
  8. Data is paginated 10 items per page. You can specify a page to fetch by passing it in the query (e.g. GET /recipes?page=4)
  9. You can filter recipes by adding a dictionary of key(string), value(array containing filter values) in your query parameter. (Example : { "cuisine": [ "Nigerian", "West African", "Ghanaian" ], "cook_time_minutes": [ 6, 10, 50 ] })
  10. Destroy user session by querying the DELETE /logout
  11. Update user by querying PUT /users/{id}
  12. Delete user by querying DELETE /users/{id}
$ curl localhost:9000/api/v1/recipes

The Core Team

About

A RESTFUL API for African foods, their recipes and general nutrition

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published