1
0
forked from blue/pica
pica/server/server.h
2023-11-23 16:57:32 -03:00

40 lines
697 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"
class Server {
public:
Server();
~Server();
void run(int socketDescriptor);
private:
void handleRequest(std::unique_ptr<Request> request);
static bool info(Request* request);
static bool printEnvironment(Request* request);
private:
bool terminating;
uint64_t requestCount;
std::optional<std::string> serverName;
Router router;
};