Skip to main content
Home
Works with
This package works with Deno, Node.js, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score70%
License
MIT
Downloads10/wk
Published7 hours ago (2.3.2)

Integrate Fedify with Express

@fedify/express: Integrate Fedify with Express

npm Matrix @fedify@hackers.pub

This package provides a simple way to integrate Fedify with Express.

The integration code looks like this:

import express from "express";
import { integrateFederation } from "@fedify/express";
import { federation } from "./federation.ts";  // Your `Federation` instance

export const app = express();

app.set("trust proxy", true);

app.use(integrateFederation(federation, (req) => "context data goes here"));

Reverse proxy with Express 4.x

If your application uses Express 4.x behind a reverse proxy with a non-standard port (e.g., Host: example.com:8080), the reconstructed request URL may lose the port number. This is because Express 4.x's req.host (which respects trust proxy) strips the port from the Host header.

This issue does not occur with Express 5.x, where req.host retains the port. If you rely on trust proxy and your origin includes a non-standard port, we recommend upgrading to Express 5.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@fedify/express

Import symbol

import * as express from "@fedify/express";
or

Import directly with a jsr specifier

import * as express from "jsr:@fedify/express";