Skip to content

yar-kik/Flask-API-bookshop

Repository files navigation

Bookshop with Flask-RESTful API

Coverage Status Build Status GitHub Python 3.8 Scrutinizer Code Quality

Technologies

Project uses such technologies:

  • Flask Rest-API with JWT-token for auth
  • PostgreSQL
  • Celery for asynchronous tasks
  • Redis for caching
  • Docker for containerizing
  • Elasticsearch

Requirements

You should have already installed Docker and Git.

Usage

Get local copy of project with:

git clone https://github.com/yar-kik/Flask-API-bookshop.git

To build a local development environment and start API server run:

docker-compose -f docker-compose-dev.yml up -d 

Or you can build a production ready environment:

docker-compose -f docker-compose.yml up -d

This may take a few minutes. Finally, your api will work on http://localhost:5000/ if you start development configuration or on http://localhost/ if you start production configs.

Functionality

With command line you can create new admin user:

docker-compose exec api python3 manage.py create_admin

Only admin can create, update and delete book items.

Application support registration, login and logout. Users can also change password via email. To make CRUD operation with books, admin should be logged-in and send request with headers {"Content-Type": "application/json", "Authorization": "Bearer <Token>"}

To make operation of filtering, sorting, pagination and searching user should use query params, for example:

  • For sorting - GET http://localhost:5000/books?order=desc&sort=price
  • For filtering - GET http://localhost:5000/books?category=fantasy&language=english
  • For pagination - GET http://localhost:5000/books?page=2
  • For searching - GET http://localhost:5000/books?q=harry+potter

It's possible to combine different query params in one request.

About

Flask REST-API with CRUD-operations, registration/authorization, searching and sending email asynchronously.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages