Skip to content

Instantly share code, notes, and snippets.

@usagi
Created May 11, 2013 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usagi/5560268 to your computer and use it in GitHub Desktop.
Save usagi/5560268 to your computer and use it in GitHub Desktop.
#include <boost/network/protocol/http/server.hpp>
namespace http = boost::network::http;
struct handler;
typedef http::server<handler> http_server;
struct handler {
void operator()
( http_server::request const & request
, http_server::response & response
)
{
response = http_server::response::stock_reply
( http_server::response::ok
, "hello, world!"
);
}
void log(http_server::string_type const & info)
{
std::cerr << "error: " << info << "\n";
}
};
int main()
{
handler h;
http_server s("0.0.0.0", "10080", h);
s.run();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment