15 lines
373 B
Go
15 lines
373 B
Go
|
package api
|
||
|
|
||
|
// Middleware for the api for middle ware management (authentication, storing data)
|
||
|
type Middleware interface {
|
||
|
Handle(ctx *Context) *Context
|
||
|
}
|
||
|
|
||
|
// MiddlewareFunc proxies to a Middleware
|
||
|
type MiddlewareFunc func(ctx *Context) *Context
|
||
|
|
||
|
// Handle implements the Middleware interface
|
||
|
func (mwf MiddlewareFunc) Handle(ctx *Context) *Context {
|
||
|
return mwf(ctx)
|
||
|
}
|