This project uses
go-chi/v5
for routinggolang-migrate/migrate
for database migrations
You can also install gin for hot-reloading during development:
go install github.com/codegangsta/gin@latest
To install the dependencies, run:
go mod tidy
You will also need to run the migrations before starting the project:
make migrate-up
To rollback the last migration, run:
make migrate-down
To create a new migration, run:
make migrate-create name=<migration_name>
This project uses PostgreSQL as the database. You can use Docker to run a PostgreSQL container:
make docker-up
To stop the container, run:
make docker-down
To run the project, run the following commands: Dev:
make run
Development with hot-reload:
make dev
Build:
make build
Prod:
make prod
To create a new table:
migrate create -ext sql -dir storage/migrations -seq create_todos_table
To run migrations:
migrate -source file://storage/migrations -database $POSTGRESQL_URL up