Documentation
¶
Overview ¶
Package server wires TableX's HTTP layer together: it builds the renderer, session manager, rate limiter and handlers, assembles the middleware chain and route table, serves embedded static assets, and manages graceful startup and shutdown (closing every session pool on the way out).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the running TableX HTTP application.
func New ¶
New constructs a Server from resolved config. It parses templates and loads icons up front so any template error surfaces at startup, not mid-request.
func (*Server) Handler ¶
Handler returns the fully-wrapped HTTP handler (middleware chain + router), used by httptest in integration tests.
func (*Server) Listen ¶
Listen binds the configured address and returns the listener, so the caller can log the ACTUAL bound address (which differs from cfg.Listen for a ":0" ephemeral port) only after the bind has succeeded — a bind failure surfaces here instead of after an already-emitted "listening" line. Pair with Serve.
func (*Server) Serve ¶
Serve serves HTTP(S) on ln and blocks until the server stops. TLS is used when configured. http.ErrServerClosed (from a clean Shutdown) is success.
func (*Server) Shutdown ¶
Shutdown drains in-flight requests, then closes every session's DB pools so credentials don't linger. It is safe to call more than once.
If the drain times out (a handler stuck past the ctx budget), it cancels every in-flight request context and force-closes the HTTP server so those handlers unwind, THEN still closes all session pools. Skipping the pool close on a timeout would leak OS-level DB connections and keep every session's credentials reachable in server-side memory — sessions.Shutdown() is the only server-exit path that closes all pools and drops the session-store references that hold them.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package handlers implements TableX's HTTP handlers — one file per feature area (auth, home, server, database, table, sql, navigation).
|
Package handlers implements TableX's HTTP handlers — one file per feature area (auth, home, server, database, table, sql, navigation). |