Categorygithub.com/cbwfree/micro-core
repository
0.1.5
Repository: https://github.com/cbwfree/micro-core.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

micro-core

Example

package main

import (
	"github.com/cbwfree/micro-core/srv"
	"github.com/cbwfree/micro-core/web"
	log "github.com/micro/go-micro/v2/logger"
)

func main() {
	srv.New(
		"admin",
		srv.FlagBasic,
		srv.FlagRedis,
		srv.FlagMongo,
		srv.FlagHttp,
	)

	srv.With(
		srv.WithMongoDB("admin"),
		srv.WithRedisDB(0),
		srv.WithWebServer("admin"),
	)

	srv.Web().With(
		web.WithEnableSession(true),
		web.WithAPIPrefix("/api"),
		web.WithAPIRoutes(
            ...
		),
	)

	// 服务初始化
	srv.Init()

	// 启动服务
	if err := srv.Run(); err != nil {
		log.Fatalf("Run Error: %v", err)
	}
}