router

package
v0.0.0-...-ea14be2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CfgGin = fx.Invoke(func(lifecycle fx.Lifecycle, g *gin.Engine, cfg *conf.Config) {
	httpServer := http.Server{
		Addr:    cfg.ListenAddr,
		Handler: g,
	}

	lifecycle.Append(fx.Hook{
		OnStart: func(ctx context.Context) error {
			go func() {
				if cfg.Debug {

					ginpprof.Wrap(g)
				}

				err := httpServer.ListenAndServe()
				if err != nil {
					panic(err)
				}
			}()

			return nil
		},
		OnStop: func(ctx context.Context) error {
			return httpServer.Shutdown(ctx)
		},
	})

})

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳