Skip to content

Latest commit

 

History

History
66 lines (57 loc) · 1.13 KB

File metadata and controls

66 lines (57 loc) · 1.13 KB

REST API in Go

This project uses

  • go-chi/v5 for routing
  • golang-migrate/migrate for database migrations

You can also install gin for hot-reloading during development:

go install github.com/codegangsta/gin@latest

Setup

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>

Database

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

Starting the Project

To run the project, run the following commands: Dev:

make run

Development with hot-reload:

make dev

Build:

make build

Prod:

make prod

Notes

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