How To Create Golang REST API: Project Layout Configuration [Part 1]

mkdir -p \
$GOPATH/src/github.com/boilerplate/pkg \
$GOPATH/src/github.com/boilerplate/cmd \
$GOPATH/src/github.com/boilerplate/db/scripts \
$GOPATH/src/github.com/boilerplate/scripts
$ cd $GOPATH/src/github.com/boilerplate && \
go mod init github.com/boilerplate
touch ./db/scripts/1_create_test_db.sh
POSTGRES_PASSWORD=password
POSTGRES_USER=postgres
POSTGRES_PORT=5432
POSTGRES_HOST=pg
POSTGRES_DB=boilerplate
TEST_DB_HOST=localhost
TEST_DB_NAME=boilerplatetest
$ docker-compose up --build
$ docker container ls
$ docker exec -it boilerplate_pg_1 /bin/bash
psql -U postgres -W

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dan Stenger

Dan Stenger

Software engineer focusing on simplicity and reliability. GO and functional programming enthusiast