Skip to content
MrGold-RumplePublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

86 Commits

Folders and files

Repository files navigation

Scaffold

  • Scaffolding for quickly building web services based on gin and zap

install

go get -u github.com/MrGold-Rumple/scaffold@v1.5.10

Usage

package main

import (
	"context"
	"github.com/gin-gonic/gin"
	"github.com/MrGold-Rumple/scaffold"
	"github.com/MrGold-Rumple/scaffold/logger"
	"github.com/MrGold-Rumple/scaffold/orm"
	"sync"
)

func init() {
	logger.InitLogger() // only os.stdout

	logger.InitPersistenceLogger("./some_logfile")
}

func main() {
	server := scaffold.NewGraceServer(":8000", gin.Default())

	server.AddBackgroundTask(func(ctx context.Context, wg *sync.WaitGroup) {
		// some background task like cronjob
	})

	server.AddDeferFunc(func() {
		// resource recycle
		logger.Debugf("exit")
	})
	server.Start()
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages