engine

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

File: http-engine.go

This file defines the http engine interface and its implementation. The http engine is responsible for handling RESTful requests. This framework uses gin as the default http engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMethodValidity added in v0.0.6

func CheckMethodValidity(method string)

func MergeRestPath added in v0.0.6

func MergeRestPath(paths ...string) string

Common util functions

func RuntimeFuncName added in v0.0.6

func RuntimeFuncName(f interface{}) string

Get the name of the function. the split the fi

Types

type IServerEngine

type IServerEngine interface {
	// Registers a controller to the engine
	RegisterController(rootPath string, controller controller.IController)

	// Run the server on the specified port
	Run(option ServerRuntimeOption)

	// Stop the server gracefully
	// Must implement a timeout if there is a possibility of a hanging.
	Stop()

	// Add middleware to the engine.
	// This will be native to the engine's core
	AddMiddleware(middleware ...interface{})

	// Add static file serving to the engine.
	// The config is specific to certain engines if they support it.
	AddStatic(prefix, root string, config ...interface{})
}

The engine must implement this interface to be used in the app.

type NullEngine

type NullEngine struct {
	IServerEngine
	// contains filtered or unexported fields
}

func NewNullEngine

func NewNullEngine() *NullEngine

func (*NullEngine) RegisterController

func (e *NullEngine) RegisterController(rootPath string, instance controller.IController)

func (*NullEngine) Run

func (e *NullEngine) Run(option ServerRuntimeOption)

func (*NullEngine) Stop

func (e *NullEngine) Stop()

type ServerEngineOption

type ServerEngineOption struct {
	GlobalApiPrefix string
}

type ServerRuntimeOption added in v0.0.6

type ServerRuntimeOption struct {
	Port int

	TLSOption *TLSOption
}

type TLSOption added in v0.0.6

type TLSOption struct {
	// The path to the certificate/key files
	CertFile string
	KeyFile  string

	// The tls config can be given directly.
	// If the Certificate is given through the config
	//, In this case, the CertFile and KeyFile will be ignored.
	Config *tls.Config
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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