The OpenD Programming Language

RequestServer.serveHttpOnce

Serves a single HTTP request on this thread, with an embedded server, then stops. Designed for cases like embedded oauth responders

Examples

import arsd.cgi;
void main() {
	RequestServer server = RequestServer("127.0.0.1", 6789);
	string oauthCode;
	string oauthScope;
	server.serveHttpOnce!((cgi) {
		oauthCode = cgi.request("code");
		oauthScope = cgi.request("scope");
		cgi.write("Thank you, please return to the application.");
	});
	// use the code and scope given
}

Meta

History

Added Oct 10, 2020.