REST API in Golang to practice.
git clone [email protected]:lucasvmiguel/go-api-test.git
You must have Golang installed and configured to work with this API.
First, generate the database schema and Golang ORM code:
make db-migrate
make db-generate
Then, run the development server:
make run-api
- Language:
Golang
- API/REST framework:
chi
- Database ORM:
Prisma
- Config reader:
godotenv
make test-unit
All config are passed using environment variables, see all them below:
Env Var | Default value |
---|---|
PORT |
8080 |
/db
: All ORM entities are auto generated using prisma./cmd
: Main applications for this project./internal
: Private application and library code./pkg
: Library code that's ok to use by external applications./.github
: CI/CD from Github.schema.prisma
: Database schema.dev.db
: Database used for development.Makefile
: Project's executable tasks.
Reference: https://github.com/golang-standards/project-layout
Check the Github actions for this repository, but in a nutshell:
- Set up Go
- Build
- Test
- Log in to the Container registry (Github)
- Build and push Docker images