Migrating from Express
UDIOT's public Express helpers let you migrate incrementally. Keep Express and
its existing middleware while introducing UDIOT controllers, request scopes or
telemetry. There is no public @tagna/udiot/ssr server entry point.
Minimal controller adapter
import 'reflect-metadata';
import assert from 'node:assert/strict';
import express from 'express';
import { Controller, Get } from '@tagna/udiot';
import { toExpressRouter } from '@tagna/udiot/server';
@Controller('/health')
class HealthController {
@Get('/')
health() { return { ok: true }; }
}
const app = express();
app.use(express.json());
app.use(toExpressRouter(HealthController));
assert.equal(typeof app, 'function');
This constructs the app without opening a listener. Add app.listen(...) in
your application entry point and test with actual HTTP requests.
Migration checklist
- Preserve existing route paths, status codes, headers and body parsing limits.
- Use
toExpressRouterto mount controllers;includeBasePath: falseis useful when the parent mount already supplies the controller prefix. - Use
createRequestScopeMiddlewarefor per-request DI instead of a global mutable user/tenant context. - Wire a real
authResolverwhen usingRequireAuth. Merely checking for an Authorization header is not authentication. - Use the documented route schema format for validation; it is not Zod or arbitrary JSON Schema.
- Keep Express middleware and UDIOT pipeline middleware distinct. A pipeline operates on its context and returns a result envelope; it is not an Express request handler without an adapter.
- Re-test Express 5 parameter shapes, async errors, wildcard routes and uploads.
See server helpers, production composition, validation and testing.
From the canonical UDIOT public documentation.Try it in the playground ↗