Skip to content

dimuska139/golang-api-skeleton

Repository files navigation

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.

About

Base API skeleton to create applications with Golang.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages