-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
29 lines (24 loc) · 763 Bytes
/
main.cpp
File metadata and controls
29 lines (24 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <boost/network/protocol/http/server.hpp>
#include <string>
#include <iostream>
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(int arg, char * argv[]) {
handler handler_;
http_server::options options(handler_);
http_server server_(
options.address("0.0.0.0")
.port("8000"));
server_.run();
}