The new decorator function.
// index.ts
import { Controller, ControllerBase, IHttpRequest, IHttpResponse, PATCH } from '@egomobile/http-server'
@Controller()
export default class IndexController extends ControllerBase {
// can be accessed with a PATCH request
// by using route /
@PATCH()
async index(request: IHttpRequest, response: IHttpResponse) {
response.write('(root): ' + new Date())
}
// can be accessed with a PATCH request
// by using route /foo
@PATCH()
async foo(request: IHttpRequest, response: IHttpResponse) {
response.write('foo: ' + new Date())
}
// can be accessed with a PATCH request
// by using route /baz
@PATCH('/baz')
async bar(request: IHttpRequest, response: IHttpResponse) {
response.write('baz: ' + new Date())
}
}
Optional
format: Nilable<HttpInputDataFormat>Optional
limit: Nilable<number>Optional
limit: Nilable<number>Generated using TypeDoc
Add a controller method to handle a PATCH request.