API reference › @evolu/nodejs › createRun
const createRun: CreateRun<RunDeps & ShutdownDep>;
Defined in: nodejs/src/Task.ts:54
Creates Run for Node.js with global error handling and graceful shutdown.
Registers uncaughtException and unhandledRejection handlers that log
errors and initiate graceful shutdown. Adds a shutdown promise to deps that
resolves on termination signals (SIGINT, SIGTERM, SIGHUP). Handlers are
removed when the Run is disposed.
Example
const deps = { ...createRelayDeps(), console };
await using run = createRun(deps);
await using stack = new AsyncDisposableStack();
stack.use(await run.orThrow(startRelay({ port: 4000 })));
await run.deps.shutdown;