integrate files with serving (even though ugly)
This commit is contained in:
parent
63fd2b7cca
commit
897310fe28
7 changed files with 83 additions and 36 deletions
|
|
@ -4,14 +4,20 @@
|
|||
#include <boost/beast/http.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/http/string_body.hpp>
|
||||
#include <variant>
|
||||
|
||||
using namespace boost::beast;
|
||||
|
||||
class RequestHandler {
|
||||
public:
|
||||
http::response<http::string_body> handle(const http::request<http::string_body>& request);
|
||||
std::variant<
|
||||
http::response<http::string_body>,
|
||||
http::response<http::file_body>
|
||||
> handle(const http::request<http::string_body>& request);
|
||||
|
||||
private:
|
||||
http::response<http::string_body> BadRequest(const std::string& why);
|
||||
http::response<http::file_body> handle_file_request(const std::string& filename, boost::system::error_code& ec);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in a new issue