generateRestJSClient

Generates JavaScript code to access a REST interface from the browser.

void
generateRestJSClient
(
I
R
)
if (
is(I == interface) &&
isOutputRange!(R, char)
)

Examples

Writes a JavaScript REST client to a local .js file.

import vibe.core.file;

interface MyAPI {
	void getFoo();
	void postBar(string param);
}

void generateJSClientImpl()
{
	import std.array : appender;

	auto app = appender!string;
	auto settings = new RestInterfaceSettings;
	settings.baseURL = URL("http://localhost/");
	generateRestJSClient!MyAPI(app, settings);
}

generateJSClientImpl();

Meta