Documentation ¶
Index ¶
- type Anser
- type EndPoint
- type HandlerChain
- type HandlerFunc
- type HttpAnser
- type IAnswer
- type Router
- func (r *Router) DELETE(path string, handlers ...HandlerFunc)
- func (r *Router) GET(path string, handlers ...HandlerFunc)
- func (r *Router) HEAD(path string, handlers ...HandlerFunc)
- func (r *Router) NewRouter(relativePath string, handlers ...HandlerFunc) *Router
- func (r *Router) PATCH(path string, handlers ...HandlerFunc)
- func (r *Router) POST(path string, handlers ...HandlerFunc)
- func (r *Router) PUT(path string, handlers ...HandlerFunc)
- type Tcp0Anser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Anser ¶
func (*Anser) Disconnect ¶ added in v1.4.0
type EndPoint ¶ added in v1.3.0
type EndPoint struct { // key: HttpMethod(GET/POST/...), value: handler functions Handlers map[string]HandlerChain // contains filtered or unexported fields }
==================================================================================================== EndPoint ====================================================================================================
func NewEndPoint ¶ added in v1.3.0
func NewEndPoint() *EndPoint
type HandlerChain ¶
type HandlerChain []HandlerFunc
type HandlerFunc ¶
type HttpAnser ¶
type HttpAnser struct { *Anser *Router // key1: Method(Get/Post); key2: node number of EndPoint; value: []*EndPoint EndPointHandlers []*EndPoint // ================================================== // CORS // ================================================== UseCors bool // 允許的來源 CorsOrigins []string // ex: 'GET, POST' CorsMethods []string // ex: 'true' CorsCredentials bool // ex: 'Authorization' CorsAllowHeaders []string // ex: 'Authorization' CorsExposeHeaders []string // ex: '3600' CorsMaxAge int32 // contains filtered or unexported fields }
func (*HttpAnser) GetContext ¶ added in v1.1.0
type IAnswer ¶
type IAnswer interface { // 開始監聽 Listen() // 執行一次主迴圈 Handler() // 數據寫出(寫到寫出緩存中) Write(int32, *[]byte, int32) error // Disconnect(cid int32) error }
func NewHttpAnser ¶
type Router ¶
type Router struct { *HttpAnser Handlers HandlerChain // contains filtered or unexported fields }
==================================================================================================== Router ====================================================================================================
func (*Router) DELETE ¶ added in v1.4.2
func (r *Router) DELETE(path string, handlers ...HandlerFunc)
func (*Router) GET ¶
func (r *Router) GET(path string, handlers ...HandlerFunc)
func (*Router) HEAD ¶ added in v1.4.2
func (r *Router) HEAD(path string, handlers ...HandlerFunc)
func (*Router) NewRouter ¶
func (r *Router) NewRouter(relativePath string, handlers ...HandlerFunc) *Router
每個 EndPoint 對應一個 Router,但每個 Router 不一定對應著一個 EndPoint
func (*Router) PATCH ¶ added in v1.4.2
func (r *Router) PATCH(path string, handlers ...HandlerFunc)
func (*Router) POST ¶
func (r *Router) POST(path string, handlers ...HandlerFunc)
func (*Router) PUT ¶ added in v1.4.2
func (r *Router) PUT(path string, handlers ...HandlerFunc)
Click to show internal directories.
Click to hide internal directories.