A undici req/res http bridge.
- node: 18
- @chubbyts/chubbyts-http-types: ^1.2.3
- undici:^6.19.2
Through NPM as @chubbyts/chubbyts-http-undici-bridge.
npm i @chubbyts/chubbyts-http-undici-bridge@^1.0.2
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)));
2024 Dominik Zogg