This repository contains a simple NoteApp API developed using Python and the Flask framework. It provides basic CRUD (Create, Read, Update, Delete) operations for managing notes. The API is built with the following Python libraries: Flask, Flask-Restful, Flask-SQLAlchemy, Flask-JWT-Extended, Flask-Marshmallow, Flask-Cors, Flask-Bcrypt, and MySQLclient.
- User authentication and authorization
- User management (update password, get user information, update user information, delete user account)
- Note management (create note, get all notes of a user, get specific note information, update note, delete note)
- Unit testing
To run this API locally, you need to have the following dependencies installed:
- Python (version >= 3.10.0)
- Flask (version >= 2.0.0)
- Flask-SQLAlchemy
- Flask-JWT-Extended
- Flask-Marshmallow
- Flask-Cors
- Flask-Bcrypt
- MySQLclient
- Clone this repository to your local machine.
git clone https://github.com/TheDayDreamer01/NoteApp-Flask-API.git
- Change into the project's directory.
cd noteapp-flask-api
- (Optional) Create a virtual environment.
virtualenv env source venv/bin/activate
- Install the required dependencies.
pip install -r requirements.txt
- Start the API server.
python server.py
By default, the API will use SQLite3 as the database for the development and testing environment. If you want to use MySQL for the production environment, please update the database configuration accordingly in the ./App/config.py
.
The following routes are available in the NoteApp API:
POST /api/auth/signin
: Login a userPOST /api/auth/signup
: Sign up a userPOST /api/auth/signout
: Sign out the current userPOST /api/auth/refresh
: Refresh access token using refresh tokenPOST /api/auth/refresh/signout
: Sign out using the refresh token
POST /api/user/<user_id>
: Update user passwordGET /api/user/<user_id>
: Get current user informationPUT /api/user/<user_id>
: Update basic information of the userDELETE /api/user/<user_id>
: Delete the user account
GET /api/note/<user_id>
: Get all notes of the current userPOST /api/note/<user_id>
: Create a new noteGET /api/note/<note_id>/<note_title>/<user_id>
: Get specific information of a notePUT /api/note/<note_id>/<note_title>/<user_id>
: Update a noteDELETE /api/note/<note_id>/<note_title>/<user_id>
: Delete a note
Unit tests for the NoteApp API are located in the Test
directory. To run the tests, execute the following command:
python -m unittest discover -s Test
Contributions to this NoteApp API are welcome! If you find any issues or want to suggest improvements, please create a new issue or submit a pull request.
This project is licensed under the MIT License. Feel free to use and modify the code as per your needs.