This project is a RESTful API developed in Go as part of a challenge for a Web Development and Cloud course. The main goal of this project is to implement a CRUD (Create, Read, Update, Delete) application for managing student data within a school, utilizing PostgreSQL for data persistence.
- CRUD Operations: Manage student data with create, read, update, and delete operations.
- RESTful API: Follows REST principles, making it easy to integrate with other systems.
- Database Integration: Uses PostgreSQL for storing and managing data.
- Database Migrations: Automatically applies database migrations to set up the schema.
- Containerization: The project includes Docker configurations for easy deployment and testing.
- Database Management: Includes pgAdmin for managing the PostgreSQL database through a web interface.
- Go: The programming language used to develop the application.
- PostgreSQL: Database used for data persistence.
- Docker: Used for containerization and easy setup of the development environment.
- GitHub Actions: Set up for CI/CD to automate the testing and deployment processes.
- Go 1.19 or higher
- Docker (if using the Docker setup)
- PostgreSQL (if running the database locally)
The project includes a docker-compose.yml
file that sets up the following services:
- PostgreSQL: A PostgreSQL database server.
- pgAdmin: A web-based database management tool for PostgreSQL.
-
Clone the repository:
git clone https://github.com/felipemacedo1/dev-cloud-challenge.git cd dev-cloud-challenge
-
Set up the environment:
- Ensure the environment variables for the database are configured in a
.env
file:WSRS_DATABASE_PORT=5432 WSRS_DATABASE_USER=postgres WSRS_DATABASE_PASSWORD=yourpassword WSRS_DATABASE_NAME=wsrs
- Ensure the environment variables for the database are configured in a
-
Run the services using Docker Compose:
docker-compose up
- This will start both the PostgreSQL database and the pgAdmin interface. pgAdmin will be accessible at
http://localhost:8081
with the default credentials provided in thedocker-compose.yml
file.
- This will start both the PostgreSQL database and the pgAdmin interface. pgAdmin will be accessible at
-
Apply Database Migrations:
- Ensure that the migrations are automatically applied when the application starts. If needed, you can run the migrations manually using the tool or method defined in your Go application.
-
Run the application:
go run main.go
-
Access the API:
- The API will be available at
http://localhost:8080
.
- The API will be available at
- GET /students: Retrieve all students.
- POST /students: Create a new student record.
- PUT /students/{id}: Update an existing student record.
- DELETE /students/{id}: Delete a student record.
The API documentation, including the Swagger UI, is available at the following link:
Feel free to fork the repository, submit issues, and open pull requests. Contributions are welcome!<!--
This project is open-source and available under the MIT License. -->