> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # serveStaticFiles > Serve static files from a directory alongside agent routes. Serve static files (HTML, CSS, JS, images) from a local directory. Includes path traversal protection, MIME type detection, and security headers (`Cache-Control`, `X-Content-Type-Options`). This method is useful for serving a web frontend alongside your agents -- for example, an admin dashboard or a configuration UI. ## **Parameters** **`directory`** `string` — required Path to the directory containing static files. Can be absolute or relative (resolved via `path.resolve()` at registration time). --- **`route`** `string` — default: / URL path prefix for static files. Trailing slashes are stripped; `'/'` serves from the root. --- ## **Returns** `void` ## **Example** ```typescript {8} import { AgentBase, AgentServer } from '@signalwire/sdk'; const support = new AgentBase({ name: 'support', route: '/support' }); support.setPromptText('You are a helpful assistant.'); const server = new AgentServer({ port: 3000 }); server.register(support); server.serveStaticFiles('./web', '/static'); await server.run(); ``` With this configuration: | Request Path | Served By | | ------------------- | --------------------------- | | `/support` | SupportAgent | | `/support/swaig` | SupportAgent SWAIG endpoint | | `/static/style.css` | `./web/style.css` | | `/static/logo.png` | `./web/logo.png` | > **Warning** > > Path traversal attempts (e.g., `/../etc/passwd`) are blocked. The resolved file path > must remain within the configured static directory. > Serve static files from a directory alongside agent routes.