ControllerDefinition #
Available since 2.8.0
The ControllerDefinition type is used to define new controllers.
This type can be found as the second argument of the Backend.controller.use method or as the Controller.definition property.
Not found: /home/runner/work/documentation/documentation/.repos/kuzzle-2/lib/types/ControllerDefinition.tsExample:
import { ControllerDefinition, KuzzleRequest } from 'kuzzle';
const definition: ControllerDefinition = {
actions: {
sayHello: {
handler: async (request: KuzzleRequest) => 'Hello',
http: [{
verb: 'post',
path: 'greeting/sayHello',
openapi: {
description: "Simply say hello",
responses: {
200: {
content: {
"application/json": {
schema: {
type: "string",
}
}
}
}
}
}
}],
}
}
};