A undici req/res http bridge.
- node: 18
- @chubbyts/chubbyts-http-types: ^3.0.0
- undici:^7.10.0
Through NPM as @chubbyts/chubbyts-http-undici-bridge.
npm i @chubbyts/chubbyts-http-undici-bridge@^2.0.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