serve
Start a FastAPI/Uvicorn web server that serves the SWML document over HTTP. This is a blocking call that runs the server until it is stopped. The server responds to both GET and POST requests at the configured route, returning the current SWML document as JSON.
On startup, the server prints the service URL and authentication credentials to the console. If routing callbacks are registered, their endpoint URLs are also displayed.
serve() blocks the current thread. For production deployments, consider using
as_router() to integrate into an existing ASGI application instead.
Parameters
host
Host to bind to. Overrides the value set in the constructor. When None, uses
the constructor’s host value.
port
Port to bind to. Overrides the value set in the constructor. When None, uses
the constructor’s port value.
ssl_cert
Path to an SSL certificate file. Overrides the SWML_SSL_CERT_PATH environment
variable.
ssl_key
Path to an SSL private key file. Overrides the SWML_SSL_KEY_PATH environment
variable.
ssl_enabled
Explicitly enable or disable SSL. Overrides the SWML_SSL_ENABLED environment
variable.
domain
Domain name for the SSL certificate. Used for URL generation when SSL is enabled.
Returns
None — This method blocks until the server is stopped.