Documentation
¶
Overview ¶
Package app runs the application as one process: a frontend and a backend that talk to each other through the internal API over an in-process transport, exactly as two processes would over the network.
The two halves are separate packages, and the frontend cannot import the backend (see pkg/frontend/boundary_test.go), so this package is the only place that holds both. The split deployment (`serve web` and `serve api`) builds each half on its own, see the cmd package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
*frontend.Frontend
*mainbackend.Backend
// contains filtered or unexported fields
}
Server is the application as one process. Names that both halves have are defined here, so they act on the combined process.
func New ¶
New builds the combined Server.
The page handlers call the backend (the internal API) through an in-process transport, and the public API is served on the same handler, without the load budget of a separate backend. The workers run in this process too, as they would in their own containers: they lease jobs from the backend through the same internal API, with a secret of their own.
func NewWithWorkers ¶
NewWithWorkers is New with options for the workers; tests point them at fake services.
func (*Server) Close ¶
func (s *Server) Close()
Close stops the background jobs of both halves and the HTTPS and HTTP/3 servers. Call it after the HTTP server has been shut down.
func (*Server) SetVersion ¶
SetVersion sets the version both halves report.