Optional
transformTo: ParameterDataTransformToThe custom and optional data transformer.
The new decorator function.
// 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
Imports one or more query parameters from URL into an argument / parameter of a handler as key/value pair.