This Flask application provides a simple API for managing student records. It includes CRUD (Create, Read, Update, Delete) operations for handling student information.
- Flask
- Swagger
- SQLAlchemy
- MySQL (as an example database)
Before running the application, make sure you have the following installed:
- Python 3
- pip (Python package installer)
- MySQL (or any other database of your choice)
-
Clone the repository:
git clone https://github.com/rafitanujaya/student-api-py.git cd student-api-py
-
Install venv:
python3 -m venv venv
actived venv
source venv/bin/activate // linux or mac os .\venv\Scripts\activate // windows
deadactived venv
deactivate
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables:
Create a
.env
file in the project root and add the following:SQLALCHEMY_DATABASE_URI=mysql+mysqlconnector://username:password@localhost:3306/student_database
Run the application:
python3 app.py
Visit http://localhost:5000/api/ui/ in your browser to access the Swagger UI and explore the API.
Endpoint:
GET /api/student
Description:
Retrieve a list of all students.
Endpoint:
POST /api/student
Description:
Create a new student.
Endpoint:
GET /api/student/{Id}
Description:
Retrieve details of a specific student by ID.
Endpoint:
PUT /api/student/{Id}
Description:
Update information for a specific student by ID.
Endpoint:
DELETE /api/student/{Id}
Description:
Delete a specific student by ID.
Explore and interact with the API using the Swagger documentation.
Visit http://localhost:5000/api/ui/ in your browser.
Feel free to contribute to the development of this project. Follow the guidelines in CONTRIBUTING.md.
This project is licensed under the MIT License.