Go Gin + go-pg realworld example application

❤ Uptrace.dev - distributed traces, logs, and errors in one place
Introduction
This project implements JSON API as specified in
RealWorld spec. It was created to demonstrate how to
use:
Project structure
Project consists of the following packages:
- rwe global package parses configs, establishes DB connections etc.
- org package manages users and tokens.
- blog package manages articles and comments.
- app folder contains application resources such as config.
- cmd/api runs HTTP server with JSON API.
- cmd/migrate_db command that runs SQL migrations.
The most interesting part for go-pg users is probably article filter.
Project bootstrap
First of all you need to create a config file changing defaults as needed:
cp app/config/dev.yml.default app/config/dev.yml
Project comes with a Makefile
that contains following recipes:
make db_reset
drops existing database and creates a new one.
make test
runs unit tests.
make api_test
runs API tests provided by
RealWorld.
After checking that tests are passing you can start API HTTP server:
go run cmd/api/*.go -env=dev