go-boilerplate

module
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2022 License: MIT

README

GO Boilerplate

Go Reference Go Report Card

Prerequisite

Install go-migrate for running migration

https://github.com/golang-migrate/migrate

App requires 2 database (postgreSQL and redis server), run from your local machine or run it using docker with the following command

# run postgreSQL
docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=go_boilerplate postgres

# run redis
docker run -d -p 6379:6379 redis
Migration

Run below command to run migration

migrate -path migration -database "${DATABASE_URL}" up

To create a new migration file

migrate create -ext sql -dir migration -seq name
Test

Run below command to run test, and make sure that all tests are passing

go test -v ./...
Running

Run below command to run app

go run ./cmd/api/main.go

Swagger URL

${BASE_URL}/swagger/index.html

You can find usefull commands in Makefile.

Directories

Path Synopsis
cmd
api
delivery
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
infrastructure
repository
transport

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL