Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 1.4 KB

README.md

File metadata and controls

31 lines (21 loc) · 1.4 KB

DEPRECATED! See go-api-layout please

Golang API skeleton

  • Config file reading (viper)
  • Migrations (golang-migrate)
  • Compile-time Dependency Injection (google/wire)
  • Working with database (where is no GORM in this skeleton but you can easily integrate it)
  • Token-Based Authentication (with sliding sessions)

Tests will be soon :)

Migrations

  1. Create migration file in /migrations directory (also you can use CLI for it).
  2. Build your application.
  3. Migrations applying automatically after you run compiled binary file.

Dependency injection

google/wire - DI without magic and run-time reflection.

To append new service to initialization you should:

  1. Create service and "provider" for it (see NewUsersAPI in /api/users.go for example).
  2. Inject provider to initialization in wire.go (first line //+build wireinject is definitely needed)
  3. Run wire command to generate wire_gen.go (file with generated initialization steps)
  4. Build/Run your app

Also you can read detailed tutorial.