16 lines
440 B
C++
16 lines
440 B
C++
#include <httpserver.hpp>
|
|
using namespace httpserver;
|
|
class hello_world_resource : public http_resource {
|
|
public:
|
|
std::shared_ptr<http_response> render(const http_request&) {
|
|
return std::shared_ptr<http_response>(new string_response("Hello, World!"));
|
|
}
|
|
};
|
|
int main(int argc, char** argv) {
|
|
webserver ws = create_webserver(8080);
|
|
hello_world_resource hwr;
|
|
ws.register_resource("/hello", &hwr);
|
|
ws.start(true);
|
|
return 0;
|
|
}
|