vibe.d beta banner
get vibe.d
0.9.7

Asynchronous I/O that doesn’t get in your way, written in D

Function status

Sets the response status code.

void status (
  int statusCode
) @safe;

Parameters

NameDescription
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);
}
Authors

Sönke Ludwig

Copyright

© 2013-2016 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.