Awesome
Go treemux + bun realworld application
Introduction
This project implements RealWorld JSON API as specified in the spec. It was created to demonstrate how to use:
Project structure
The project uses Bun starter kit and consists of the following packages:
- bunapp package parses configs, establishes DB connections etc.
- org package manages users and tokens.
- blog package manages articles and comments.
- cmd/bun provides CLI commands to run HTTP server and work with DB.
- cmd/bun/migrations contains database migrations.
The most interesting part for Bun users is probably article filter.
Project bootstrap
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 run HTTP server:
go run cmd/bun/main.go -env=dev api