Function json

  • JSON body middleware factory

    Type Parameters

    Returns Middleware<I, O, I & {
        body: Json;
    }, O>

    Remarks

    The returned middleware enriches the input with a body property containing the parsed JSON body.

  • JSON body middleware factory

    Type Parameters

    Parameters

    • schema: T

      Schema to validate the JSON body with

    Returns Middleware<I, O, I & {
        body: TypeOf<T>;
    }, O>

    Remarks

    The returned middleware enriches the input with a body property containing the JSON body parsed and validated with the given schema.

  • JSON body middleware factory

    Type Parameters

    • const K extends string
    • I extends Context
    • O

    Parameters

    • key: K

      Key to use for the JSON body property

    Returns Middleware<I, O, I & {
        [body in K]: Json
    }, O>

    Remarks

    The returned middleware enriches the input with a property with the given key containing the parsed JSON body.

  • JSON body middleware factory

    Type Parameters

    Parameters

    • key: K

      Key to use for the JSON body property

    • schema: T

      Schema to validate the JSON body with

    Returns Middleware<I, O, I & {
        [body in K]: TypeOf<T>
    }, O>

    Remarks

    The returned middleware enriches the input with a property with the given key containing the JSON body parsed and validated with the given schema.

Generated using TypeDoc