This is an example project in Go using GORM and Fiber.
git clone https://github.com/PabloCacciagioni/project_golang.git
cd project_golang
Make sure you have Docker and Docker Compose installed on your system.
Lift database and application containers using Docker Compose:
docker-compose up -d
This will raise two services:
Runs the database migrations to create the necessary tables. This is done automatically on application initialization when connecting to the database.
The application should be running at http://localhost:8000.
Available routes
GET /todos/:id:
Obtain a todo by ID.POST /todos:
Create a new todo.PUT /todos/:id:
Update a todo by ID. DELETE /todos/:id:
Delete a todo by ID.To run the tests, make sure the Docker containers are running, and then run:
go test -v routes_test.go
main.go:
Application entry point.database/:
Database connection and configuration.config/:
Configuration of the URL used for the database connection.models/:
Definition of data models.routes/:
Definition of routes and controllers.Dockerfile:
Docker configuration file for the application.docker-compose.yml:
Docker Compose configuration file.