Skip to content

CristianUser/go-bun-webserver

Repository files navigation

Go bunrouter + bun application example

build workflow PkgGoDev

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages