This is a generic class to provide middleware for Browse/Read/Edit/Add/Delete operations and forms. It comes with some baked-in pre-flight checks but needs to be extended to do useful work. All default actions except reads require being logged in.

Use the bakery method to create standard BREAD routes. :)

Hierarchy (View Summary)

Indexable

  • [key: string]: unknown

Constructors

Properties

action: string
actions: Record<string, BreadAction<unknown>>
editing: boolean = false
getResourceErrorHandler: (
    messageKeyPrefix: string,
    bodyParam: string,
) => (error: unknown) => void
id?: string
isPreview: boolean = false
messageKeyPrefix: string
method: string
next: NextFunction
renderPermissionError: BoundRenderFunction
renderResourceError: BoundRenderFunction
renderSigninRequired: BoundRenderFunction
renderTemplate: BoundTemplateRenderer
req: ProviderRequest
res: ProviderResponse

Methods

  • Parameters

    Returns {
        author: string;
        authorURL: string;
        createdOn: Date;
        html: Record<string, string>;
        reviewURL: string;
        starRating: number;
        text: Record<string, string>;
        thingLabel: Record<string, string>;
        thingURL: string;
        thingURLs: string[];
        title: Record<string, string>;
    }