/flask-rest-api-project

🛒 Implemented an Order and Delivery Backend System with Database Management, including User Authentication and Staff Authorization. Streamlined Operations with Monitoring of Production Descriptions and Delivery Status.

Primary LanguagePython

FLASK REST API PROJECT, deployed on Render.com

Deployed in Render.com, check it out 👉 https://flask-rest-api-project-rmrw.onrender.com/
Database transformation: SQLite -> PostgreSQL

Tools and Technologies 🛠️:

Flask, Flask-SQLAlchemy, Flask-JWT-Extended, Flask-RESTX, Python-Decouple, PyTest, SwaggerUI, Werkzeug, Unittest, Render.com, PostgreSQL, DB browser, SQLite

Practicing Include 📚:

  • Flask REST API with Python
  • Environment variables with Python-Decouple
  • JWT Authentication with Flask-JWT-Extended
  • Databases with Flask-SQLAlchemy
  • How to write Unit Tests with Unittest and PyTest
  • Documenting REST APIs with SwaggerUI and Flask-RESTX
  • Error Handling with Werkzeug

Basic Setup 🚀

Enter the project folder and create a virtual environment

$ python -m venv env
$ source env/bin/actvate #On linux Or Unix
$ source env/Scripts/activate #On Windows
$ pip install -r requirements.txt #Install all requirements
python runserver.py #Run the server

Changed the id type from integer to serial in the table

Note: While transferring the database schema from SQLite to PostgreSQL, I encountered errors when signing up new users and creating new orders in SwaggerUI. After thorough troubleshooting, I discovered that PostgreSQL does not auto-increment the ID, unlike SQLite. To resolve this, I deleted the transformed old table in HeidiSQL, changed the ID type to serial, created a new table, inserted data, and implemented SQL auto-increment code in the table, which resolved the issue.

DEMO Time 🛒

Run the project in development environment

Database: SQLite || Backend test tool: Thunder Client
localhost http://127.0.0.1:5000/ screenshot1

Run the project in production environment

screenshot1

1. Signup a new user

screenshot1 screenshot1

2. Login with the user

screenshot1 screenshot1

3. Authorization with JWT successfully

s

s

Reference:

👍 Very good Flask learning resource from Youtuber Ssali Jonathan