Documentation ¶
Index ¶
- Variables
- func AsIsResponse(engine *Engine)
- type AuthKeyPlacing
- type Engine
- type Middleware
- type Middlewares
- type MiddlewaresAPI
- type Option
- type Register
- type Request
- type Response
- type Route
- type RouteByPath
- func CONNECT(route Route, middlewares ...Register) RouteByPath
- func DELETE(route Route, middlewares ...Register) RouteByPath
- func GET(route Route, middlewares ...Register) RouteByPath
- func HEAD(route Route, middlewares ...Register) RouteByPath
- func OPTIONS(route Route, middlewares ...Register) RouteByPath
- func PATCH(route Route, middlewares ...Register) RouteByPath
- func POST(route Route, middlewares ...Register) RouteByPath
- func PUT(route Route, middlewares ...Register) RouteByPath
- func TRACE(route Route, middlewares ...Register) RouteByPath
- type Routes
- type Service
- type ServiceAPI
Constants ¶
This section is empty.
Variables ¶
var ( AllowedHeaders = cors.AllowedHeaders AllowedMethods = cors.AllowedMethods AllowedOrigins = cors.AllowedOrigins )
var ( NoAuth = auth.NoAuth BasicAuth = auth.Basic BearerAuth = auth.Bearer // TODO: remake it APIKeyAuth = func(key, value string, place AuthKeyPlacing) request.Middleware { return auth.APIKey(key, value, placing.Placing(place)) } )
var ( ErrMethodNotAppliable = fmt.Errorf("method not appliable for path") ErrPathNotFound = fmt.Errorf("path not found for method") )
Functions ¶
func AsIsResponse ¶
func AsIsResponse(engine *Engine)
AsIsResponse - tells server to response objects without wrapping.
Types ¶
type AuthKeyPlacing ¶
const ( InQuery AuthKeyPlacing = AuthKeyPlacing(placing.InQuery) InCookie AuthKeyPlacing = AuthKeyPlacing(placing.InCookie) InHeader AuthKeyPlacing = AuthKeyPlacing(placing.InHeader) )
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine - server provider.
func (*Engine) RegisterServices ¶
func (e *Engine) RegisterServices(services ...ServiceAPI) error
RegisterServices - registering service routes.
func (*Engine) Start ¶
Start listens on the TCP network address srv.Addr and then calls Serve to handle requests on incoming connections. Accepted connections are configured to enable TCP keep-alives.
Start always returns a non-nil error. After Shutdown or Close, the returned error is ErrServerClosed.
type Middleware ¶
type Middleware func(*Service)
type Middlewares ¶
type Middlewares []Middleware
type MiddlewaresAPI ¶
type MiddlewaresAPI interface {
Middlewares() []Register
}
type Option ¶
type Option func(*Engine)
func ResponseAsJSON ¶
ResponseAsJSON - tells server to serialize responses as JSON using object as wrapper.
func ResponseAsXML ¶
ResponseAsXML - tells server to serialize responses as XML using object as wrapper.
func WithResponse ¶
WithResponse - tells server to use object as wrapper for all responses.
type Register ¶
type Register middlewares.Register
func UseAuthorization ¶
func UseAuthorization(option request.Middleware) Register
func UseCORS ¶
func UseCORS(opts ...cors.CORSOption) Register
type RouteByPath ¶
func CONNECT ¶
func CONNECT(route Route, middlewares ...Register) RouteByPath
CONNECT - implements CONNECT api method call.
func DELETE ¶
func DELETE(route Route, middlewares ...Register) RouteByPath
DELETE - implements DELETE api method call.
func GET ¶
func GET(route Route, middlewares ...Register) RouteByPath
GET - implements GET api method call.
func HEAD ¶
func HEAD(route Route, middlewares ...Register) RouteByPath
HEAD - implements HEAD api method call.
func OPTIONS ¶
func OPTIONS(route Route, middlewares ...Register) RouteByPath
OPTIONS - implements OPTIONS api method call.
func PATCH ¶
func PATCH(route Route, middlewares ...Register) RouteByPath
PATCH - implements PATCH api method call.
func POST ¶
func POST(route Route, middlewares ...Register) RouteByPath
POST - implements POST api method call.
func PUT ¶
func PUT(route Route, middlewares ...Register) RouteByPath
PUT - implements PUT api method call.
func TRACE ¶
func TRACE(route Route, middlewares ...Register) RouteByPath
TRACE - implements TRACE api method call.
type Routes ¶
type Routes map[string]RouteByPath
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service - provides basic service methods.
func NewService ¶
func NewService(engine *Engine, api ServiceAPI, path string) *Service