Optional
transformer: ParameterDataTransformerThe custom transformer function to use.
Optional
Rest
...names: string[]One or more headers to import. If the list is empty, all parameters are taken.
The new decorator function.
// index.ts
import { Controller, ControllerBase, GET, IHttpRequest, IHttpResponse, Request, Response, Url } from '@egomobile/http-server'
interface IUrl {
"bar": string;
"buzz": number;
}
@Controller()
export default class IndexController extends ControllerBase {
@GET('/foo/:bar/:buzz')
async getBar(
@Url(({ key, source }) => {
if (key === 'buzz') {
return Number(source)
}
return source
}, 'bar', 'buzz') importedUrl: IUrl,
@Response() response: IHttpResponse
) {
response.write(`bar: ${importedHeaders['bar']} (${typeof importedHeaders['bar']})\n`)
response.write(`buzz: ${importedHeaders['buzz']} (${typeof importedHeaders['buzz']})\n`)
}
}
Rest
...names: string[]Generated using TypeDoc
Imports one or more URL parameters into an argument / parameter of a handler as key/value pair.