vibe.d beta banner
get vibe.d
0.8.4

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

Function generateRestJSClient

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

void generateRestJSClient(I, R) (
  ref R output,
  RestInterfaceSettings settings = null
)
if (is(I == interface) && isOutputRange!(R, char));

Example

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

import vibe.core.file;

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

void generateJSClientImpl()
{
	auto app = appender!string;
	generateRestJSClient!MyAPI(app);
	writeFileUTF8(Path("myapi.js"), app.data);
}
Authors

Sönke Ludwig, Михаил Страшун

Copyright

© 2012-2013 RejectedSoftware e.K.

License

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