Skip to main content
This release is 3 versions behind 1.2.3 — the latest version of @fedify/fedify. Jump to latest

Built and signed on GitHub Actions

An ActivityPub/fediverse server framework

This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
100%
Published
a week ago (1.2.0)
method Federation.setActorDispatcher
Federation.setActorDispatcher(
path: `${string}{identifier}${string}` | `${string}{handle}${string}`,
dispatcher: ActorDispatcher<TContextData>,
): ActorCallbackSetters<TContextData>

Registers an actor dispatcher.

Examples

Example 1

federation.setActorDispatcher(
  "/users/{identifier}",
  async (ctx, identifier) => {
    return new Person({
      id: ctx.getActorUri(identifier),
      // ...
    });
  }
);

Parameters

path: `${string}{identifier}${string}` | `${string}{handle}${string}`

The URI path pattern for the actor dispatcher. The syntax is based on URI Template (RFC 6570). The path must have one variable: {identifier}.

dispatcher: ActorDispatcher<TContextData>

An actor dispatcher callback to register.

Return Type

ActorCallbackSetters<TContextData>

An object with methods to set other actor dispatcher callbacks.

Throws

RouterError

Thrown if the path pattern is invalid.

Add Package

deno add jsr:@fedify/fedify

Import symbol

import { type Federation } from "@fedify/fedify";

---- OR ----

Import directly with a jsr specifier

import { type Federation } from "jsr:@fedify/fedify";

Add Package

npx jsr add @fedify/fedify

Import symbol

import { type Federation } from "@fedify/fedify";

Add Package

yarn dlx jsr add @fedify/fedify

Import symbol

import { type Federation } from "@fedify/fedify";

Add Package

pnpm dlx jsr add @fedify/fedify

Import symbol

import { type Federation } from "@fedify/fedify";

Add Package

bunx jsr add @fedify/fedify

Import symbol

import { type Federation } from "@fedify/fedify";