mpromonet / libhttpjsonserver

HTTP/WS server wrapping civetweb using lambda

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libhttpjsonserver

HTTP/WS server wrapping civetweb using lambda

Factorisation of http server code to implement JSON RPC over HTTP/ws

	// http api callbacks
	std::map<std::string,HttpServerRequestHandler::httpFunction> func;
	func["/echo"]   = [](const struct mg_request_info *req_info, const Json::Value & in) -> Json::Value { 
		return in;
	};

	HttpServerRequestHandler httpServer(func, options);
	if (httpServer.getContext() != NULL)
	{
		std::cout << "Started on port:" << port << " webroot:" << webroot << std::endl; 
		signal(SIGINT, signal_handler);
		while (!exitFlag) {
			sleep(1);
		}
	}

About

HTTP/WS server wrapping civetweb using lambda

License:The Unlicense


Languages

Language:C++ 89.4%Language:CMake 6.5%Language:JavaScript 4.0%