The_Mentor_FLASK
Table of Contents
About The Project
RESRful API for The Mentor App Backend.
This API uses HTTP response codes to indenticate status and errors.
All responses come in standard JSON with Jsend format
All requests must include a content-type
of application/json
and the body must be valid JSON.
Structure
├── README.md
├── The_Mentor.sql # SQL File for mysqldb
├── app
│ ├── MatchHandler.py # API Resource for match, heart, hashtag
│ ├── UserHandler.py # API Resource for user authentication
│ ├── database.py # Database init
│ ├── docs # Documentation folder
│ ├── messages.py # Response message class
│ ├── models.py # Models for flask-sqlalchemy
├── config.py # App Config
├── requirements.txt
├── run.py # Run app
Built With
Getting Started
To get a local copy up and running follow these simple steps.
Prerequisites
- MySQL
brew install mysql
Installation
- Clone the repo
git clone https://github.com/github_username/repo_name.git
- Install requirements
pip install -r requirements.txt
- Set up MySQL database server (create a db and run the_mentor.sql session)
How-to (Docker recommended)
- Run
python3 run.py
You can still access the API structure in http://localhost:5000/apidocs without Step 3
API Documentation
Documentation is done with Flassger.
Flasgger comes with SwaggerUI embedded so you can access http://localhost:5000/apidocs and visualize and interact with your API resources.
Response Codes
200: Success
400: Bad request
401: Unauthorized
404: Cannot be found
405: Method not allowed
422: Unprocessable Entity
50X: Server Error
Example Success Message
http code 200
{
"status" : "success",
"data" : {}
}
Example Fail Message
http code 422
{
"status" : "fail",
"data" : {"password": "Password does not match schema"}
}