Node Handler API (resuxjs/node)
resuxjs/node is the focused production Node HTTP entry point. It exports the production request handler factory and its options without requiring callers to import the CLI module directly.
Server-only
This API uses Node IncomingMessage / ServerResponse behavior and production build artifacts. It is not browser code and is not an edge-runtime-neutral Fetch handler.
Imports
import {
createResuxNodeHandler,
type ResuxNodeHandlerOptions
} from 'resuxjs/node'ResuxNodeHandlerOptions
interface ResuxNodeHandlerOptions {
appRoot?: string
outDir?: string
securityHeaders?: boolean
}| Option | Default | Description |
|---|---|---|
appRoot | process.cwd() | Application root used by the production request pipeline. |
outDir | <appRoot>/.resux | Compiled Resux output directory. |
securityHeaders | true | Enables the production handler's built-in security-header behavior. |
Paths are resolved to absolute paths when the handler is created.
createResuxNodeHandler()
function createResuxNodeHandler(
options?: ResuxNodeHandlerOptions
): (request: IncomingMessage, response: ServerResponse) => voidExample with Node's HTTP server:
import { createServer } from 'node:http'
import { createResuxNodeHandler } from 'resuxjs/node'
const handler = createResuxNodeHandler({
appRoot: process.cwd(),
securityHeaders: true
})
createServer(handler).listen(3000)The returned handler dispatches each request through Resux's production request pipeline using the resolved app/output paths and non-development build settings.
Production guard
Creating the handler calls the framework's production Halal Core report guard for the selected output directory before requests are served. In a normal non-test production environment, an invalid or missing authenticated report prevents startup according to the guard behavior.
See Halal Core for report signing/verification requirements.
Build requirement
createResuxNodeHandler() expects compiled application output; it does not run buildProject() for you.
Typical flow:
resux build
node server.mjsUse the normal Resux start/deployment commands when you do not need to embed the request handler in a custom Node server.
Security headers
securityHeaders defaults to true. Disable it only when another trusted layer owns the complete response-header policy and you have verified there is no coverage gap:
const handler = createResuxNodeHandler({
securityHeaders: false
})Do not disable the setting merely to work around a CSP/header bug; fix the deployment/header composition instead.
Runtime and resumability
This API owns the server request boundary. It serves the server-rendered HTML/payload/runtime artifacts generated by the Resux build, but importing resuxjs/node does not change the client resumability model or make application components Vue-hydrated.