go-todo

A standard-library focused Go JSON API server example with PostgreSQL persistence, full CRUD, authentication, and test coverage.
Install
go get github.com/bcomnes/go-todo
Development
This project requires a local PostgreSQL database.
Running Tests
Unit tests run by default:
make test
Integration (PostgreSQL) tests are skipped unless explicitly enabled:
make test TEST_FLAGS='-args -db'
Or manually:
go test ./... -args -db
Migrations
make migrate-up
make migrate-down
Environment Variables
The server and tests rely on the following environment variables (can be set in a .env file):
DATABASE_URL=postgres://postgres@localhost/go-todo?sslmode=disable
PORT=8080
HOST=0.0.0.0
Usage
package main
import (
"fmt"
"github.com/bcomnes/go-todo"
)
func main() {
fmt.Println("hello world")
}
See more examples on PkgGoDev.
API
See API docs on PkgGoDev.
License
MIT