echoServer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorResp

func ErrorResp(c echo.Context, status int, data interface{}, msg string) error

status <0

func Init

func Init(serverConfig Config) error

func Init_

func Init_(name string, serverConfig Config) error

Init a new instance.

If only need one instance, use empty name "". Use GetDefaultInstance() to get.
If you need several instance, run Init() with different <name>. Use GetInstance(<name>) to get.

func SuccessResp

func SuccessResp(c echo.Context, status int, data interface{}, msg string) error

status >0

Types

type Config

type Config struct {
	Port         int
	StaticFolder string
}

http_port http_static_rel_folder

type EchoServer

type EchoServer struct {
	*echo.Echo
	Http_port              int
	Http_static_abs_folder string
}

func GetInstance

func GetInstance() *EchoServer

func GetInstance_

func GetInstance_(name string) *EchoServer

func (*EchoServer) Close

func (s *EchoServer) Close()

func (*EchoServer) Start

func (s *EchoServer) Start() error

func (*EchoServer) StaticWeb

func (s *EchoServer) StaticWeb()

type RespBody

type RespBody struct {
	Status int         `json:"status" `
	Result interface{} `json:"result" `
	Msg    string      `json:"msg" `
}

Jump to

Keyboard shortcuts

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