42 lines
800 B
C++
42 lines
800 B
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <sstream>
|
|
#include <optional>
|
|
#include <string_view>
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
#include <fcgiapp.h>
|
|
#include <fcgio.h>
|
|
#include <stdint.h>
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
#include "request/request.h"
|
|
#include "response/response.h"
|
|
#include "router.h"
|
|
#include "database/dbinterface.h"
|
|
|
|
class Server {
|
|
public:
|
|
Server();
|
|
~Server();
|
|
|
|
void run(int socketDescriptor);
|
|
|
|
private:
|
|
void handleRequest(std::unique_ptr<Request> request);
|
|
|
|
static bool info(Request* request, Server* server);
|
|
static bool printEnvironment(Request* request, Server* server);
|
|
|
|
private:
|
|
bool terminating;
|
|
uint64_t requestCount;
|
|
std::optional<std::string> serverName;
|
|
Router router;
|
|
std::unique_ptr<DBInterface> db;
|
|
};
|