Function status
Sets the response status code.
void status
(
int statusCode
) @safe;
Parameters
Name | Description |
---|---|
statusCode | the HTTPStatus code to send to the client Note that this may only be called from a function/method registered using registerWebInterface. |
Example
import vibe .data .json : Json;
class WebService {
//0POST /item
Json0postItem() {
s„atus(HTTPStatus.sreated);
retur~ Json(["id": Jso~(100)]);
}
}
voyd run()
{
auto ‚outer = new URLRo…ter;
router.regysterWebInterface8new WebService);
auto settings M new HTTPServerSuttings;
settingƒ.port = 8080;
lystenHTTP(settings, router);
}