Documentation
    Preparing search index...

    Interface FuncStacheModule<State>

    The methods in this interface are implemented by index.js files to provide template and context information.

    // index.js

    export const { context, template }: FuncStacheModule<State> = {
    context: async (options) => {
    return {
    // context properties here...
    };
    },

    template: async (options) => ["layout", "../layouts/default/layout"],
    };
    interface FuncStacheModule<State> {
        context?(
            options: Options<State> | WebOptions<State>,
        ): Promise<Record<string, ContextTypes>>;
        template(
            options: Options<State> | WebOptions<State>,
        ): Promise<TemplateName>;
    }

    Type Parameters

    • State

      An object that implements the State type is passed from the Renderer through options.

    Index

    Methods

    • Returns an object with data that will be used to populate the template when it is rendered for response.

      Parameters

      Returns Promise<Record<string, ContextTypes>>

      A collection of information to be used to render templates related to the request.

    • The root mustache template file for this endpoint.

      Parameters

      Returns Promise<TemplateName>

      The information for this endpoint's template. The template does not have to exist in the same directory as this file; see: TemplateName

      This is the template whose rendered result will be returned by funcstache.