A undici req/res http bridge.
- node: 18
- @chubbyts/chubbyts-http-types: ^1.3.1
- undici:^7.2.0
Through NPM as @chubbyts/chubbyts-http-undici-bridge.
npm i @chubbyts/chubbyts-http-undici-bridge@^1.1.1
import {
createServerRequestFactory,
createUriFactory,
} from '@chubbyts/chubbyts-http/dist/message-factory';
import { createUndiciToServerRequestFactory, createResponseToUndiciFactory } from '@chubbyts/chubbyts-http-undici-bridge/dist/undici-http';
const app = ...;
const undiciToServerRequestFactory = createUndiciToServerRequestFactory(
createUriFactory(),
createServerRequestFactory(),
);
const responseToUndiciFactory = createResponseToUndiciFactory();
const res = responseToUndiciFactory(await app(undiciToServerRequestFactory(req)));
2025 Dominik Zogg