Documentation
¶
Overview ¶
Package web holds the HTTP server, the routes, the middleware, the handlers and the server-sent event streams. It never imports internal/store.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientIPFunc ¶ added in v1.1.0
ClientIPFunc returns the function that finds the address of the client of a request, for the login limiter: the connection's address, or with trustProxy the last address of X-Forwarded-For (see clientIP). It is what the API is given as api.Options.ClientIP.
Types ¶
type HealthChecker ¶ added in v1.1.0
type HealthChecker interface {
// Check returns nil when the database answers within ctx.
Check(ctx context.Context) error
}
HealthChecker tells whether the server can do its work. app.Health is the one the binary uses.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the HTTP server of Clowder: the routes, the middleware and the handlers. Make it with New.
func New ¶
New makes the server from its dependencies. Run starts it. It fails when the embedded static files cannot be read and hashed.
type Services ¶
type Services struct {
// Accounts is the service of login, sessions, invitations and users.
Accounts *app.Accounts
// Rooms is the service of rooms and their memberships.
Rooms *app.Rooms
// Audit is the service that reads the audit log.
Audit *app.Audit
// Posts is the service of posts, their tags and their feeds.
Posts *app.Posts
// Board is the service of the Kanban boards. The streams read it to find
// the posts whose tasks a change of the columns concerns.
Board *app.Board
// Search is the service of search.
Search *app.Search
// Notifications is the service of the notifications of a user: their
// unread count in the sidebar and their page.
Notifications *app.Notifications
// Messages is the service of private conversations and messages: their
// pages, their streams and the unread count in the sidebar.
Messages *app.Messages
// Health answers the health check, GET /healthz (SPEC D40). Nil makes
// the check answer 503.
Health HealthChecker
// API is the REST API (SPEC D42). Its routes are mounted on the same mux
// under /api/v1/ and never read the session cookie. Nil serves no API:
// every /api/ path is then the page-not-found error page.
API *api.Server
// Hub delivers the live events of the services to the streams of the
// pages (SPEC §8). The services must publish to the same hub. Nil makes a
// hub that nothing publishes to.
Hub *live.Hub
}
Services are the services the handlers call. Later steps add a field for each service they build.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package static holds the files the server sends as they are: the Datastar client, the stylesheet and the scripts.
|
Package static holds the files the server sends as they are: the Datastar client, the stylesheet and the scripts. |
|
Package views holds the templ components and pages.
|
Package views holds the templ components and pages. |