Actions
Controller methods decorated with at least one HTTP method decorator are treated as actions. HTTP method decorators specifiy which HTTP request methods are valid for an action.
import { controller, get, post } from 'kikwit';
@controller
export class Products {
@get
list(context) {
...
}
@post
add(context) {
...
}
}
An action can be decorated by more than one HTTP method decorator.
import { controller, post, put } from 'kikwit';
@controller
export class Products {
@post
@put
edit(context) {
...
}
}
The @all
decorator makes the decorated action valid for any HTTP request method.
Supported http methods
Decorator | HTTP Method |
---|---|
@all | (Any method) |
@acl | ACL |
@baselineControl | BASELINE-CONTROL |
@checkin | CHECKIN |
@checkout | CHECKOUT |
@copy | COPY |
@del | DELETE |
@get | GET |
@head | HEAD |
@label | LABEL |
@lock | LOCK |
@merge | MERGE |
@mkactivity | MKACTIVITY |
@mkcol | MKCOL |
@mkworkspace | MKWORKSPACE |
@move | MOVE |
@options | OPTIONS |
@orderpatch | ORDERPATCH |
@patch | PATCH |
@post | POST |
@propfind | PROPFIND |
@proppatch | PROPPATCH |
@put | PUT |
@report | REPORT |
@search | SEARCH |
@trace | TRACE |
@unlock | UNLOCK |
@update | UPDATE |
@versionControl | VERSION-CONTROL |
@uncheckout | UNCHECKOUT |