Documentation
¶
Index ¶
- func LoadTemplateFunctions(engine *gin.Engine)
- func LoadTemplates(engine *gin.Engine) error
- type Router
- func (r *Router) AttachGlobalMiddleware(handlers ...gin.HandlerFunc) gin.IRoutes
- func (r *Router) AttachGroup(relativePath string, handlers ...gin.HandlerFunc) *gin.RouterGroup
- func (r *Router) AttachHandler(method string, path string, handler gin.HandlerFunc)
- func (r *Router) AttachNoRouteHandler(handler gin.HandlerFunc)
- func (r *Router) Start()
- func (r *Router) Stop(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadTemplateFunctions ¶ added in v0.2.0
func LoadTemplates ¶ added in v0.3.8
LoadTemplates loads html templates for use by the given engine
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router provides the HTTP REST interface for GoToSocial, using gin.
func New ¶
New returns a new Router, which wraps an http server and gin handler engine.
The router's Attach functions should be used *before* the router is Started.
When the router's work is finished, Stop should be called on it to close connections gracefully.
The provided context will be used as the base context for all requests passing through the underlying http.Server, so this should be a long-running context.
func (*Router) AttachGlobalMiddleware ¶ added in v0.7.0
func (r *Router) AttachGlobalMiddleware(handlers ...gin.HandlerFunc) gin.IRoutes
func (*Router) AttachGroup ¶ added in v0.3.8
func (r *Router) AttachGroup(relativePath string, handlers ...gin.HandlerFunc) *gin.RouterGroup
func (*Router) AttachHandler ¶
func (r *Router) AttachHandler(method string, path string, handler gin.HandlerFunc)
func (*Router) AttachNoRouteHandler ¶
func (r *Router) AttachNoRouteHandler(handler gin.HandlerFunc)
Click to show internal directories.
Click to hide internal directories.