• Imports one or more query parameters from URL into an argument / parameter of a handler as key/value pair.

    Parameters

    Returns ParameterDecorator

    The new decorator function.

    Example

    // index.ts

    import { Body, Controller, ControllerBase, IHttpRequest, IHttpResponse, POST, Request, Response, text, Use } from '@egomobile/http-server'

    @Controller()
    @Use(text())
    export default class IndexController extends ControllerBase {
    @POST('/foo')
    async postFoo(
    @Body(({ source }) => JSON.parse(source)) importedBody: any,

    @Response() response: IHttpResponse
    ) {
    response.write(`body: ${JSON.stringify(importedBody)}`)
    }
    }

Generated using TypeDoc