function createRestApp
createRestApp(options?: RestStarterOptions): IKernelApplication

Creates a fully wired REST application. The factory registers the curated REST plugin set, adds the error-handler middleware at priority 0 (outermost per the exceptions contract), and returns the un-started application.

The caller adds routes and then calls await app.start({ port }).

Examples

Example 1

import { createRestApp } from '@setu-ts/rest-starter';

const app = createRestApp();
app.router.get('/hello', (ctx) => ctx.response.text('Hello world'));
await app.start({ port: 3000 });

Parameters

optional
options: RestStarterOptions

Optional per-plugin configuration.

Return Type

IKernelApplication

An IKernelApplication ready for route registration.

Usage

import { createRestApp } from "starters/rest-starter/src/index.ts";