Created
May 11, 2013 15:27
-
-
Save usagi/5560268 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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
refs