mirror of
https://github.com/Mercantec-GHC/h5-projekt-mst.git
synced 2026-08-27 05:37:39 +02:00
37 lines
647 B
C++
37 lines
647 B
C++
#pragma once
|
|
|
|
#include "tcp.h"
|
|
#include <cstdint>
|
|
#include <expected>
|
|
#include <netinet/in.h>
|
|
#include <string>
|
|
|
|
namespace mst {
|
|
template <typename T> using Result = std::expected<T, std::string>;
|
|
|
|
class HttpServer;
|
|
|
|
class HttpDaemon {
|
|
|
|
public:
|
|
HttpDaemon(HttpServer&, TcpConnection connection)
|
|
: connection(connection) { };
|
|
|
|
private:
|
|
TcpConnection connection;
|
|
};
|
|
|
|
class HttpServer {
|
|
|
|
public:
|
|
auto start() -> Result<void>;
|
|
static auto bind(const std::string& host, uint16_t port)
|
|
-> Result<HttpServer>;
|
|
|
|
private:
|
|
HttpServer(TcpListener listener)
|
|
: listener(listener) { };
|
|
TcpListener listener;
|
|
};
|
|
}
|