Skip to content

uzhegovaelena/recipes-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recipes API

Technology stack:

  • Python 3.8.5
  • Aiohttp 3.7.4
  • PostgreSQL 5.2

Сommands to start the service:

  • python -m venv
  • .\recipes-project\Scripts\activate
  • pip install -r requirements.txt
  • python app.py

Database:

  • Create Database 'recipes'
  • Run all SQL queries from the file "queries" (creating the necessary tables and filling with test data).

Link

Enviroment variables:

PORT=8080

# variables for DB connection:
DB_DATABASE=recipes
DB_USER=replace_me
DB_PASSWORD=replace_me
DB_HOST=localhost
DB_PORT=5432

Endpoints

Users

Create a new user

curl --request POST \
  --url http://localhost:8080/users \
  --header 'Content-Type: application/json' \
  --data '{
  "username": "test",
  "email": "[email protected]",
  "password": "test"
}'

Get user info by username

curl --request GET \
  --url http://localhost:8080/users/[username] \
  --header 'apikey: ***'

Authentication

curl --request GET \
  --url http://localhost:8080/users/auth \
  --header 'Content-Type: application/json' \
  --data '{
  "email": "[email protected]",
  "password": "test"
}'

Get top 10 users by numbers of recipes

curl --request GET \
  --url http://localhost:8080/users/top \
  --header 'apikey: ***'

Recipes

Create a new recipe

curl --request POST \
  --url http://localhost:8080/recipes \
  --header 'Content-Type: application/json' \
  --header 'apikey: ***' \
  --data '{
  "title": "title",
  "description": "description"
}'

Get list of recipes

curl --request GET \
  --url 'http://localhost:8080/recipes?limit=10&offset=0' \
  --header 'apikey: ***'

Get a recipe

curl --request GET \
  --url http://localhost:8080/recipes/[recipe_id] \
  --header 'apikey: ***'

TODO

  • Implement part for favorites recipes
  • Add more fields to recipes: type, hashtag, photo and steps
  • Implement admin API
  • Add pagination for recipes
  • Add option to filter recipes

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages