2020-06-24 16:46:05 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
2020-06-24 17:35:37 +08:00
|
|
|
#include "detail/http_server_impl.hpp"
|
2020-06-24 16:46:05 +08:00
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
class http_server : public http_server_impl {
|
|
|
|
public:
|
|
|
|
http_server(const char* addr) : http_server_impl(addr) {}
|
|
|
|
~http_server(void) {}
|
|
|
|
|
|
|
|
void run(int nthreads) {
|
|
|
|
http_server_impl::run(nthreads);
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
void get(const std::string path, handler_t fn) {
|
2020-06-24 17:35:37 +08:00
|
|
|
this->service(path, fn);
|
2020-06-24 16:46:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void post(const std::string& path, handler_t fn) {
|
2020-06-24 17:35:37 +08:00
|
|
|
this->service(path, fn);
|
2020-06-24 16:46:05 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace acl
|