Loading README.md +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ Currently, Fedify provides the following features out of the box: - [NodeInfo] protocol - Special touch for interoperability with Mastodon and few other popular fediverse software - Integration with various web frameworks - CLI toolchain for testing and debugging If you want to know more about the project, please take a look at the following Loading docs/intro.md +2 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,8 @@ Currently, Fedify provides the following features out of the box: - [NodeInfo] protocol - Special touch for interoperability with Mastodon and few other popular fediverse software - CLI toolchain for testing and debugging - [Integration with various web frameworks](./manual/integration.md) - [CLI toolchain for testing and debugging](./cli.md) If you want to know more about the project, please take a look at the following resources: Loading docs/manual/integration.md +32 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,38 @@ Fedify is designed to be used together with web frameworks. This document explains how to integrate Fedify with web frameworks. Astro ----- *This API is available since Fedify 0.12.0.* [Astro] is a web framework for content-driven websites. Fedify has the `@fedify/fedify/x/astro` module that provides a middleware to integrate Fedify with Astro. Put the following code in your *src/middleware.ts* file: ~~~~ typescript import type { MiddlewareHandler } from "astro"; import { createFederation } from "@fedify/fedify"; import { createMiddleware } from "@fedify/fedify/x/astro"; const federation = createFederation<string>({ // Omitted for brevity; see the related section for details. }); export const onRequest: MiddlewareHandler = createMiddleware( federation, (astroContext) => "context data", ); ~~~~ > [!NOTE] > > Astro integration requires [on-demand server rendering][1]. [Astro]: https://astro.build/ [1]: https://docs.astro.build/en/guides/server-side-rendering/ Hono ---- Loading mod.ts +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ * - [NodeInfo] protocol * - Special touch for interoperability with Mastodon and few other popular * fediverse software * - Integration with various web frameworks * - CLI toolchain for testing and debugging * * If you want to know more about the project, please take a look at the Loading x/astro.ts +7 −0 Original line number Diff line number Diff line Loading @@ -5,7 +5,12 @@ * This module contains some utilities for integrating Fedify with * the [Astro] framework. * * > [!NOTE] * > * > Astro integration requires [on-demand server rendering][1]. * * [Astro]: https://astro.build/ * [1]: https://docs.astro.build/en/guides/server-side-rendering/ * * @module * @since 0.12.0 Loading Loading @@ -34,6 +39,7 @@ type MiddlewareHandler<TAstroContext extends AstroContext> = ( * @example src/middleware.ts * ``` typescript * import { defineMiddleware } from "astro:middleware"; * import { createFetchOptions } from "@fedify/fedify/x/astro"; * import { federation } from "./federation"; // Import the `Federation` object * * export const onRequest = defineMiddleware((context, next) => { Loading Loading @@ -106,6 +112,7 @@ export type ContextDataFactory< * @example src/middleware.ts * ``` typescript * import type { MiddlewareHandler } from "astro"; * import { createMiddleware } from "@fedify/fedify/x/astro"; * import { federation } from "./federation"; // Import the `Federation` object * * export const onRequest: MiddlewareHandler = createMiddleware( Loading Loading
README.md +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ Currently, Fedify provides the following features out of the box: - [NodeInfo] protocol - Special touch for interoperability with Mastodon and few other popular fediverse software - Integration with various web frameworks - CLI toolchain for testing and debugging If you want to know more about the project, please take a look at the following Loading
docs/intro.md +2 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,8 @@ Currently, Fedify provides the following features out of the box: - [NodeInfo] protocol - Special touch for interoperability with Mastodon and few other popular fediverse software - CLI toolchain for testing and debugging - [Integration with various web frameworks](./manual/integration.md) - [CLI toolchain for testing and debugging](./cli.md) If you want to know more about the project, please take a look at the following resources: Loading
docs/manual/integration.md +32 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,38 @@ Fedify is designed to be used together with web frameworks. This document explains how to integrate Fedify with web frameworks. Astro ----- *This API is available since Fedify 0.12.0.* [Astro] is a web framework for content-driven websites. Fedify has the `@fedify/fedify/x/astro` module that provides a middleware to integrate Fedify with Astro. Put the following code in your *src/middleware.ts* file: ~~~~ typescript import type { MiddlewareHandler } from "astro"; import { createFederation } from "@fedify/fedify"; import { createMiddleware } from "@fedify/fedify/x/astro"; const federation = createFederation<string>({ // Omitted for brevity; see the related section for details. }); export const onRequest: MiddlewareHandler = createMiddleware( federation, (astroContext) => "context data", ); ~~~~ > [!NOTE] > > Astro integration requires [on-demand server rendering][1]. [Astro]: https://astro.build/ [1]: https://docs.astro.build/en/guides/server-side-rendering/ Hono ---- Loading
mod.ts +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ * - [NodeInfo] protocol * - Special touch for interoperability with Mastodon and few other popular * fediverse software * - Integration with various web frameworks * - CLI toolchain for testing and debugging * * If you want to know more about the project, please take a look at the Loading
x/astro.ts +7 −0 Original line number Diff line number Diff line Loading @@ -5,7 +5,12 @@ * This module contains some utilities for integrating Fedify with * the [Astro] framework. * * > [!NOTE] * > * > Astro integration requires [on-demand server rendering][1]. * * [Astro]: https://astro.build/ * [1]: https://docs.astro.build/en/guides/server-side-rendering/ * * @module * @since 0.12.0 Loading Loading @@ -34,6 +39,7 @@ type MiddlewareHandler<TAstroContext extends AstroContext> = ( * @example src/middleware.ts * ``` typescript * import { defineMiddleware } from "astro:middleware"; * import { createFetchOptions } from "@fedify/fedify/x/astro"; * import { federation } from "./federation"; // Import the `Federation` object * * export const onRequest = defineMiddleware((context, next) => { Loading Loading @@ -106,6 +112,7 @@ export type ContextDataFactory< * @example src/middleware.ts * ``` typescript * import type { MiddlewareHandler } from "astro"; * import { createMiddleware } from "@fedify/fedify/x/astro"; * import { federation } from "./federation"; // Import the `Federation` object * * export const onRequest: MiddlewareHandler = createMiddleware( Loading