Options
All
  • Public
  • Public/Protected
  • All
Menu

@unifed/backend-federation-server

This package implements the federation server, which conforms to the protocol defined in here. The GraphQL server and other external servers communicate with the federation server to perform federated actions.

Index

Variables

Const app

app: Express = ...

The main entry point of the application.

An Express application which hosts the HTTP server.

internal

Const routes

routes: AsyncRouterInstance = ...

Functions

getCommunityOrThrow

  • getCommunityOrThrow(id: string, code: number): Promise<DocumentType<Community>>
  • Gets a community from the database or throws an error.

    internal

    Parameters

    • id: string

      ID of the community to fetch.

    • code: number

      The HTTP error code to throw.

    Returns Promise<DocumentType<Community>>

    The retrieved community.

getPostOrThrow

  • getPostOrThrow(id: string, code: number): Promise<DocumentType<Post>>
  • Gets a post from the database or throws an error.

    internal

    Parameters

    • id: string

      ID of the post to fetch.

    • code: number

      The HTTP error code to throw.

    Returns Promise<DocumentType<Post>>

    The retrieved community.

processParam

  • processParam<T>(params: Request["query"], name: string, processor: (value: string, name: string) => Promise<T | undefined> | T | undefined): Promise<T | undefined>
  • Processes parameters from a request.

    internal

    Type parameters

    • T

      The type of the parsed value from the parameter.

    Parameters

    • params: Request["query"]

      The parameters to process.

    • name: string

      Name of the parameter to process.

    • processor: (value: string, name: string) => Promise<T | undefined> | T | undefined

      The processor function.

        • (value: string, name: string): Promise<T | undefined> | T | undefined
        • Parameters

          • value: string
          • name: string

          Returns Promise<T | undefined> | T | undefined

    Returns Promise<T | undefined>

    The parsed value.

throwValidationError

  • throwValidationError(errors: ValidationError[]): void

Generated using TypeDoc