Documentation
¶
Overview ¶
Package app is the composition root: it builds the real adapters from the configuration, connects them to the use cases, and hands back the HTTP handler. It is the only place that knows every adapter; the layers it joins know only the ports between them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Serve ¶
Serve builds the application and serves it on ln until ctx is done, then shuts down: it ends the replies being written, lets requests finish, and releases the database. It is the program's whole run, so the program and the tests that stand in for it go through the same lines.
The caller opens ln first. Building runs the startup recovery, which marks every reply still streaming as interrupted; a second process that cannot get the port must fail before it can do that to the first one's live replies.
Types ¶
type App ¶
type App struct {
// Handler serves every route, wrapped in the standard middleware.
Handler http.Handler
// EndStreams ends the replies being written, saving each as stopped. The
// server calls it as it starts to shut down.
EndStreams func()
// contains filtered or unexported fields
}
App is the assembled application.