Skip to content

gopher-cafeteria/hemli-api

Repository files navigation

title description tags
Chi
A Chi server for Hemli API
chi
golang
postgres

Hemli API

✨ How to run web server

  1. Install dependencies
$ go get -d ./...
  1. navigate to the cmd directory
$ cd .\cmd\
  1. run the application
$ go run .

🗄 Database and Migrations

  • Hemli API uses Postgresql as main database source. In order to have an up and running postgres DB make sure you have docker installed on your local machine.Run following command to have postgres container up and running.

$ docker-compose up -d
  • Once database is up and running, run migrations to have required tables created.

Please note: in order to run sql-migrate and all migration commands, you need to have pre-installed CLI tools. More information and instalation instructions check in official documentation.


$ make migrate-up
  • similarly you can run following command to rollback all migrations
$ make migrate-down
  • In order to create a new migration file, run following command in your terminal.
$ sql-migrate new MY_TABLE