routes

package
v0.0.0-...-611b6d6 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package routes : manage the echo route

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("routes",
	fx.Provide(
		NewEcho,
	),
	fx.Invoke(decorators...),
	fx.Invoke(fx.Annotate(
		NewHTTPServer,
		fx.OnStart(startHook),
		fx.OnStop(stopHook),
	)),
)

Module routes module, it provides a new echo instance and adds all the routes to it and starts the server in fx.Lifecycle

Functions

func AddRouters

func AddRouters(param AddRoutersParam) *echo.Echo

AddRouters adds all the routes to echo

func NewEcho

func NewEcho(logger *zap.Logger) *echo.Echo

NewEcho returns a new echo instance and basic middleware is added

func NewHTTPServer

func NewHTTPServer(e *echo.Echo, c *config.Config) *http.Server

NewHTTPServer starts the HTTP server in fx.Lifecycle, so that it can be gracefully shutdown.

Types

type AddRoutersParam

type AddRoutersParam struct {
	fx.In
	PublicApis   []*api.API `group:"public"`
	OptionalApis []*api.API `group:"optional"`
	PrivateApis  []*api.API `group:"private"`
	E            *echo.Echo
	Signer       *logic.JWTSigner
	Config       *config.Config
}

AddRoutersParam is the param for AddRouters

type CustomBinder

type CustomBinder struct {
	// contains filtered or unexported fields
}

CustomBinder is a custom binder to bind request body to struct

func NewCustomBinder

func NewCustomBinder() *CustomBinder

NewCustomBinder returns a new CustomBinder

func (*CustomBinder) Bind

func (b *CustomBinder) Bind(v any, c echo.Context) error

Bind implements echo.Binder interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL