Unverified Commit fc3e4756 authored by Hong Minhee (洪 民憙)'s avatar Hong Minhee (洪 民憙) Committed by GitHub
Browse files

Merge pull request #450 from nyeong/issue/272

Create Fastify integration
parents f28b6855 6c45a03f
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -195,6 +195,21 @@ To be released.
 -  Added CommonJS support alongside ESM for better compatibility with
    CommonJS-based Node.js applications.  [[#429], [#431]]

### @fedify/fastify

 -  Created [Fastify] integration as the *@fedify/fastify* package.
    [[#151], [#450] by An Subin]

     -  Added `fedifyPlugin()` function for integrating Fedify into Fastify
        applications.
     -  Converts between Fastify's request/reply API and Web Standards
        `Request`/`Response`.
     -  Supports both ESM and CommonJS for broad Node.js compatibility.

[Fastify]: https://fastify.dev/
[#151]: https://github.com/fedify-dev/fedify/issues/151
[#450]: https://github.com/fedify-dev/fedify/pull/450

### @fedify/h3

 -  Added CommonJS support alongside ESM for better compatibility with
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
    "./packages/cfworkers",
    "./packages/denokv",
    "./packages/express",
    "./packages/fastify",
    "./packages/h3",
    "./packages/hono",
    "./packages/koa",
+323 −159

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ const REFERENCES = {
    { text: "@fedify/cfworkers", link: "https://jsr.io/@fedify/cfworkers/doc" },
    { text: "@fedify/denokv", link: "https://jsr.io/@fedify/denokv/doc" },
    { text: "@fedify/express", link: "https://jsr.io/@fedify/express/doc" },
    { text: "@fedify/fastify", link: "https://jsr.io/@fedify/fastify/doc" },
    { text: "@fedify/h3", link: "https://jsr.io/@fedify/h3/doc" },
    { text: "@fedify/hono", link: "https://jsr.io/@fedify/hono/doc" },
    { text: "@fedify/koa", link: "https://jsr.io/@fedify/koa/doc" },
+53 −0
Original line number Diff line number Diff line
@@ -121,6 +121,59 @@ app.use(integrateFederation(federation, (req) => "context data goes here")); //
[Express]: https://expressjs.com/


Fastify
-------

*This API is available since Fedify 1.9.0.*

[Fastify] is a fast and low overhead web framework for Node.js, with
a powerful plugin architecture and sensible defaults.  The *@fedify/fastify*
package provides a plugin to integrate Fedify with Fastify:

::: code-group

~~~~ sh [npm]
npm add @fedify/fastify
~~~~

~~~~ sh [pnpm]
pnpm add @fedify/fastify
~~~~

~~~~ sh [Yarn]
yarn add @fedify/fastify
~~~~

~~~~ sh [Bun]
bun add @fedify/fastify
~~~~

:::

~~~~ typescript twoslash
// @noErrors: 2345
import Fastify from "fastify";
import { fedifyPlugin } from "@fedify/fastify";
import { createFederation } from "@fedify/fedify";

export const federation = createFederation<void>({
  // Omitted for brevity; see the related section for details.
});

const fastify = Fastify({ logger: true });

// Register the Fedify plugin:
await fastify.register(fedifyPlugin, {  // [!code highlight]
  federation,  // [!code highlight]
  contextDataFactory: () => undefined,  // [!code highlight]
});  // [!code highlight]

fastify.listen({ port: 3000 });
~~~~

[Fastify]: https://fastify.dev/


Koa
---

Loading