This project provides a RESTful API for managing student records using FastAPI and MySQL. All configurations and provisioning are automated with Ansible and Vagrant. The API supports CRUD operations to create, read, update, and delete student information.
Before you begin, ensure you have the following installed:
- Vagrant 2.4.1: Download Vagrant
- VirtualBox: Download VirtualBox
- Ansible: Download Ansible
Important
Ensure that the Vagrant machine has access to the internet for package installations.
- Clone the Repository
git clone https://github.com/yourusername/student-management-api.git cd student-management-api/app
- Update Database Credentials
- Create a file named
.env
in theapp
directory with the following content:DB_USER=your_mysql_username DB_PASSWORD=your_mysql_password DB_HOST=localhost DB_DATABASE=universidad
- Replace
your_mysql_username
andyour_mysql_password
with your desired MySQL credentials. The root password will also need to be set in the Ansible playbook.
- Run Vagrant
vagrant up
- Access the API
- Once the setup is complete, the API will be accessible at
http://localhost:8000
- Stopping the Virtual Machine
vagrant halt
- Destroying the Virtual Machine
vagrant destroy
POST /students/
: Create a new studentGET /students/
: Retrieve all studentsGET /students/{student_id}
: Retrieve a student by IDPUT /students/{student_id}
: Update a student's informationDELETE /students/{student_id}
: Delete a student by ID
This project is licensed under the MIT License. See the LICENSE file for details.