Docs/routingv1.0.0-rc.1

API routing conventions

For public controller routing use Controller and HTTP method decorators from the root entry point, then toExpressRouter from @tagna/udiot/server. AIController is internal and not a public npm export. APIRouteGenerator is exposed only as a root type declaration, not a callable generator value.

Explicit route versioning

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('/products')
class ProductController {
  @Get('/')
  list() { return []; }
}
const app = express();
app.use('/api/v1', toExpressRouter(ProductController));
assert.equal(typeof app, 'function');

This mounts /api/v1/products/. Keep prefixes explicit and test them with contract tests; no AI metadata decorator is needed to version the mount. Use separate controllers/routers when versions differ.

File conventions and generation

Public route convention helpers describe/discover paths; discovery alone does not establish that every file is safely mounted or authorized. Review the auto-router guide for its actual API and constraints. Generated controller templates are starting points; compile them and replace unsupported imports/placeholders before use.

Use CLI API comparison to inspect OpenAPI compatibility and server OpenAPI generation for the actual mounted controller contract. Validate path/query/body shapes and authorization separately.

From the canonical UDIOT public documentation.Try it in the playground ↗