A REST API boilerplate
- TODOS: CRUD around TODOS
- go1.16
- Docker
Install go packages and dependencies before continue
go install
- This is will make a new PostgreSQL running in the standard port
5432
- Please shutdown any previous conflicting PostgreSQL instances before starting this
docker-compose up -d
Check the database is up
docker logs -f content_pg
Check that you can log into a database with psql
docker exec -it content_pg psql -U content_pg_user content_pg_db
View tables
\dt
go run main.go
# or air with live reload
air
After the application starts, go to http://localhost:$PORT/swagger/index.html
to access swagger
playground
Observartion: You must change $PORT
for the port to be used in your
environment
Creating tests database Only integration tests are supported. Backend is spun up on a special database
Tests use their own database. To create it:
docker exec -it content_pg psql -U content_pg_user -c "create database content_pg_db_test" content_pg_db
Note that in backend/config/typeorm.config.ts the content_db_test database is configured to synchronize TypeORM migrations automatically, unlike the development database.
# unit tests
go test
Before building application to production, make sure environment variables are applied correctly
Building for production
go build
- Add environment variables
- Add migrations to mongo-db-driver
- Add optional parameters to swagger
- Add bearer auth to swagger
- Add unit tests
- Add integration tests
- Add e2e tests
- Add log system
- Add health check
Observation: Some TODOS are spread across the code and need to be fixed ASAP
- go - Go is an open source programming language supported by Google
- Lucas Silva joao.galiano.silva@gmail.com - Developer
See also the list of contributors who participated in this project
Copyright © 2020 Lucas Silva
This project is MIT licensed