Documentation ¶
Index ¶
- func Register[Req proto.Message, Res proto.Message, A interface{}](m *Module[A], pathSpec string, ...)
- type Module
- func (m *Module[A]) Init(c *service.Config)
- func (m *Module[A]) Public(pathSpec string, h router.Handle)
- func (m *Module[A]) PublicDELETE(path string, h router.Handle)
- func (m *Module[A]) PublicGET(path string, h router.Handle)
- func (m *Module[A]) PublicPATCH(path string, h router.Handle)
- func (m *Module[A]) PublicPOST(path string, h router.Handle)
- func (m *Module[A]) PublicPUT(path string, h router.Handle)
- type Route
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Module ¶
type Module[AuthSession interface{}] struct { Logger *logger.Module Config *config.Module Router *router.Module Auth *users.Module // RequireAuth runs before all Register routes in this module (not Public routes) Use this to // parse an auth session from the request. Override authenticators may be passed via the // variadic authenticators argument RequireAuth func(router.Handle, ...users.Authenticator) router.Handle // GetAuthSession is use to pull an AuthSession (ideally provided by RequireAuth above) out of // the request context. Note that nil auth sessions are okay; if you want to require an auth // session, implement GetAuthSession to throw an ErrNotAuthorized when your auth session is nil GetAuthSession func(req *http.Request) (*AuthSession, error) // contains filtered or unexported fields }
Module router implements basic routing with helpers for protobuf-rootd responses.
func (*Module[A]) PublicDELETE ¶
DELETE is a shortcut for m.Router.DELETE. NOT authed
func (*Module[A]) PublicPATCH ¶
PATCH is a shortcut for m.Router.PATCH. NOT authed
func (*Module[A]) PublicPOST ¶
POST is a shortcut for m.Router.POST. NOT authed
Click to show internal directories.
Click to hide internal directories.