A RESTful API for managing student records.
- Docker and Docker Compose
- Clone the repository:
git clone <repository-url>
cd <project-directory>- Build and start the containers:
docker-compose up -d --build- Create the database table:
docker exec -it soa_mysql mysql -u root -proot soa -e "CREATE TABLE IF NOT EXISTS estudiante (
cedula VARCHAR(20) PRIMARY KEY,
nombre VARCHAR(100) NOT NULL,
apellido VARCHAR(100) NOT NULL,
direccion TEXT,
telefono VARCHAR(20)
);"-
The API will be available at:
- GET http://localhost:8000/api/students.php - List all students
- POST http://localhost:8000/api/students.php - Create a new student
- DELETE http://localhost:8000/api/students.php?cedula=XXX - Delete a student
-
To test the API endpoints, run:
chmod +x tests/api_test.sh
./tests/api_test.shReturns a list of all students.
Creates a new student.
{
"cedula": "12345",
"nombre": "John",
"apellido": "Doe",
"direccion": "123 Main St",
"telefono": "555-0123"
}Deletes a student by their cedula.
- Start containers:
docker-compose up -d - Stop containers:
docker-compose down - View logs:
docker-compose logs -f - Rebuild containers:
docker-compose up -d --build