Giter VIP home page Giter VIP logo

flask-restapi-shop's Introduction

flask restapi shop

Requirements

  • Python 3+
  • Virtualenv
  • Docker

Create virtual environment & install requirements

virtualenv <envname> -p python3

source <envname>/bin/activate

pip install -r requirements.txt

Add dotenv to project root

You should create a .env file on the project root using the following format:

JWT_SECRET_KEY = "random string"

Create Postgres DB using Docker

docker run -d --name restapi-shop -e POSTGRES_PASSWORD=postgres -p 127.0.0.1:5432:5432 postgres

Make migrations

python manager.py db init

python manager.py db migrate

python manager.py db upgrade

Fill the database with test data

python data_upload.py

Run

python run.py

This example provides the following API structure:

URL method endpoint Usage Access Data
/api/signup/ POST SignupApi Create account free access {"str:email", "str:password"}
/api/login/ POST LoginApi Login free access {"str:email", "str:password"}
/api/catalog/<int:page> GET CatalogView Get a list of all products free access  
/api/category/<int:id> GET CategoryView Get category information token  
/api/category/ POST CategoryView Create category token {"str:category_name", "str:category_description"}
/api/category/<int:id> PUT CategoryView Update category token {"str:category_name", "str:category_description"}
/api/category/<int:id> DELETE CategoryView Delete category token  
/api/product/<int:id> GET ProductView Get product information token  
/api/product/ POST ProductView Get product information token {"str:name", "str:description", "float:price", "int:quantity", "int:category_id"}
/api/product/<int:id> PUT ProductView Get product information token {"str:name", "str:description", "float:price", "int:quantity", "int:category_id"}
/api/product/<int:id> DELETE ProductView Get product information token  

flask-restapi-shop's People

Contributors

traffox avatar

Watchers

 avatar

Forkers

estolyaroff

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.