- JWT Authentication
- Error Handling
- File Uploading
- Public & Admin Routes
- CRUD Operations
flask_rest_api_project/
│
├── app/
│ ├── __init__.py
│ ├── models.py
│ ├── routes/
│ │ ├── admin_routes.py
│ │ ├── public_routes.py
│ │
│ └── utils/
│ ├── error_handlers.py
│
│
├── uploads/
├── instance/
├── .env
├── .gitignore
├── requirements.txt
├── run.py
└── README.md
-
Clone or Download the Repository
git clone https://github.com/yourusername/flask_rest_api_project.git cd flask_rest_api_project -
Create Virtual Environment
python -m venv venv -
Activate the Environment
- Windows:
venv\Scripts\activate - Mac/Linux:
source venv/bin/activate
- Windows:
-
Install Dependencies
pip install -r requirements.txt -
Set Up Environment Variables
Create a.envfile in the project root and add:DATABASE_URI = sqlite:///site.db _SECRET_KEY = supersecretkey -
Create the Database
python >>> from run import app >>> from app import db >>> app.app_context().push() >>> db.create_all() >>> exit() -
Run the App
python run.pyThe app will run at: http://127.0.0.1:5000
GET /items– Get all public items
POST /admin/register– Register new userPOST /admin/login– Login & get JWT tokenGET /admin/dashboard– Test protected routePOST /admin/item– Create new itemPUT /admin/item/<id>– Update an itemDELETE /admin/item/<id>– Delete an itemPOST /admin/upload– Upload a file
- Allowed Types:
.png,.jpg,.jpeg,.pdf - Max File Size: 2 MB
- Uploads saved in:
/uploadsdirectory
-
Snigdha Aravapalli
Email: snigdha.aravapalli@csu.fullerton.edu -
Harika Animireddy Gari
Email: Harikareddy@csu.fullerton.edu -
Yashwanth Reddy Mallareddygari
Email: YashwanthR@csu.fullerton.edu