Project for learning golang by applying it to create an API with chi
├── configs
│ └── config.go
├── db
│ └── migrations
│ └── connection.go
├── docs
│ └── docs.go
│ └── swagger.json
│ └── swagger.yaml
├── handlers
│ └── create.go
│ └── delete.go
│ └── list.go
│ └── retrieve.go
│ └── update.go
├── models
│ └── delete.go
│ └── entities.go
│ └── get_all.go
│ └── get.go
│ └── insert.go
│ └── update.go
├── .pre-commit-config.yaml
├── .commitlint.config.js
├── config.toml
├── docker-compose.yml
├── go.mod
├── go.sum
├── main.go
├── README.md- Clone the repository
git clone https://github.com/SousaPedro11/api-postgres-go.git- Install dependencies
go mod download- Run the project
go run main.go- Run the project
docker-compose upAfter run You can access the API at http://localhost:9000 and the swagger at http://localhost:9000/swagger/index.html. The api port and the database port can be changed in the config.toml file.
I added some tools to help me with the project:
- pre-commit to format the code and the commitlint to validate the commit messages, lint the code and run the tests.
- docker-compose to run the project with postgres database.
- swagger to document the API.
- viper to read the config file.
- validator to validate the request body.
- golang-migrate to run the migrations.