module
Version:
v0.0.0-...-1d3a159
Opens a new window with list of versions in this module.
Published: May 22, 2023
License: BSD-2-Clause
Opens a new window with license information.
README
¶
Go bunrouter + bun application example
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 sessions.
- 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 start
start docker containers, run migrations and run HTTP server.
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
Directories
¶
|
|
|
|
cmd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.