Skip to content

SousaPedro11/api-postgres-go

Repository files navigation

Api-Postgres-Go

Project for learning golang by applying it to create an API with chi

Table of Contents

Technologies

Project Structure

├── 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

Getting Started

  • Clone the repository
git clone https://github.com/SousaPedro11/api-postgres-go.git

Without Docker

  • Install dependencies
go mod download
  • Run the project
go run main.go

With Docker

  • Run the project
docker-compose up

After 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.

Plus

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.

References

About

Project for learning golang by applying it to create an API with chi

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published