Documentation ¶
Index ¶
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 interface { // Attach global gin middlewares to this router. AttachGlobalMiddleware(handlers ...gin.HandlerFunc) gin.IRoutes // AttachGroup attaches the given handlers into a group with the given relativePath as // base path for that group. It then returns the *gin.RouterGroup so that the caller // can add any extra middlewares etc specific to that group, as desired. AttachGroup(relativePath string, handlers ...gin.HandlerFunc) *gin.RouterGroup // Attach a single gin handler to the router with the given method and path. // To make middleware management easier, AttachGroup should be preferred where possible. // However, this function can be used for attaching single handlers that only require // global middlewares. AttachHandler(method string, path string, handler gin.HandlerFunc) // Attach 404 NoRoute handler AttachNoRouteHandler(handler gin.HandlerFunc) // Start the router Start() // Stop the router Stop(ctx context.Context) error }
Router provides the REST interface for gotosocial, using gin.
func New ¶
New returns a new Router.
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.
Click to show internal directories.
Click to hide internal directories.