slumber: github.com/4eek/slumber/server Index | Files

package server

import "github.com/4eek/slumber/server"

Index

Package Files

access_controller.go router.go server.go

Constants

const BodyLimitBytes uint32 = 1048576 * 5

Request JSON body limit is set at 5MB (currently not enforced)

type AccessController Uses

type AccessController struct {
    ACLMap domain.ACLMap
    // contains filtered or unexported fields
}

implements IAccessController

func NewAccessController Uses

func NewAccessController(ctx domain.IContext, renderer domain.IRenderer) *AccessController

TODO: Currently, AccessController only acts as a gateway for endpoints on router level. Build AC to handler other aspects of ACL

func (*AccessController) Add Uses

func (ac *AccessController) Add(aclMap *domain.ACLMap)

func (*AccessController) AddHandler Uses

func (ac *AccessController) AddHandler(action string, handler domain.ACLHandlerFunc)

func (*AccessController) HasAction Uses

func (ac *AccessController) HasAction(action string) bool

func (*AccessController) IsHTTPRequestAuthorized Uses

func (ac *AccessController) IsHTTPRequestAuthorized(req *http.Request, ctx domain.IContext, action string, user domain.IUser) (bool, string)

func (*AccessController) NewContextHandler Uses

func (ac *AccessController) NewContextHandler(action string, next http.HandlerFunc) http.HandlerFunc

type Config Uses

type Config struct {
    Context domain.IContext
}

Config type

type ErrorResponse Uses

type ErrorResponse struct {
    Message string `json:"message,omitempty"`
    Success bool   `json:"success"`
}

type Router Uses

type Router struct {
    *mux.Router
    // contains filtered or unexported fields
}

Router type

func NewRouter Uses

func NewRouter(ctx domain.IContext, ac domain.IAccessController) *Router

NewRouter Returns a new Router object

func (*Router) AddResources Uses

func (router *Router) AddResources(resources ...domain.IResource) *Router

func (*Router) AddRoutes Uses

func (router *Router) AddRoutes(routes *domain.Routes) *Router

type Server Uses

type Server struct {
    Context domain.IContext
    // contains filtered or unexported fields
}

Server type

func NewServer Uses

func NewServer(options *Config) *Server

NewServer Returns a new Server object

func (*Server) Run Uses

func (s *Server) Run(address string, timeout time.Duration) *Server

func (*Server) ServeHTTP Uses

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) *Server

func (*Server) Stop Uses

func (s *Server) Stop()

func (*Server) UseContextMiddleware Uses

func (s *Server) UseContextMiddleware(middleware domain.IContextMiddleware) *Server

func (*Server) UseMiddleware Uses

func (s *Server) UseMiddleware(middleware domain.IMiddleware) *Server

func (*Server) UseRouter Uses

func (s *Server) UseRouter(router *Router) *Server

Package server imports 9 packages (graph). Updated 2017-05-18. Refresh now. Tools for package owners. This is a dead-end fork (no commits since the fork).