44 lines
830 B
C++
44 lines
830 B
C++
// SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#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"
|
|
#include "utils/helpers.h"
|
|
#include "config.h"
|
|
|
|
class Server {
|
|
public:
|
|
Server();
|
|
~Server();
|
|
|
|
void run(int socketDescriptor);
|
|
|
|
private:
|
|
void handleRequest(std::unique_ptr<Request> request);
|
|
|
|
private:
|
|
bool terminating;
|
|
uint64_t requestCount;
|
|
std::optional<std::string> serverName;
|
|
Router router;
|
|
std::unique_ptr<DBInterface> db;
|
|
};
|