Host on Bun
Bun runs the app as WebAssembly, serving raw sockets with Bun.listen. For a plain server, the native binary is faster and has more features.
Build
rustup target add wasm32-unknown-unknown # once
wisp build --target bun # dist/bun (--out <folder>)
Deploy
From dist/bun:
bun server.mjs
The folder's package.json has "start": "bun server.mjs". Copy the folder to the machine and run it there.
Environment
WISP_SECRET: set it in the process environment, for an app that signs cookies.- Read other values with
wisp::env("KEY")(std::env::varsees nothing). WISP_NODE_HTTP=1serves withBun.serveinstead ofBun.listen. See Environment variables.
Limits
- The app's own HTTP/1.1 parser answers over raw sockets (pipelining, keep-alive, chunked bodies, 413, 431 and each route's
BODY_LIMIT). At startup a request over loopback must be answered as the app answers it (twice, on one connection); if not, it serves withBun.serveand one stderr line says so. - WebSockets answer 501; use
Response::events(SSE). - No threads or files: use
wisp::spawnandwisp::sleep. See What works on the edge. - There is no cron trigger to write: the build says so and stops when the app uses
wisp::cron.
Files and Data
Table::savedandRestare per-instance memory unlessWISP_STOREis set (libsql://; see Saved tables).
More
Edge and serverless targets, Deploying.
Is This Page Useful?