1
0
forked from blue/pica
pica/server/server.h

42 lines
800 B
C
Raw Normal View History

2023-11-21 22:19:08 +00:00
#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>
2023-11-23 19:57:32 +00:00
#include <nlohmann/json.hpp>
2023-11-21 22:19:08 +00:00
#include "request/request.h"
#include "response/response.h"
2023-11-23 19:57:32 +00:00
#include "router.h"
2023-12-07 20:32:43 +00:00
#include "database/dbinterface.h"
2023-11-21 22:19:08 +00:00
class Server {
public:
Server();
~Server();
void run(int socketDescriptor);
private:
void handleRequest(std::unique_ptr<Request> request);
2023-11-23 19:57:32 +00:00
2023-12-07 20:32:43 +00:00
static bool info(Request* request, Server* server);
static bool printEnvironment(Request* request, Server* server);
2023-11-21 22:19:08 +00:00
private:
bool terminating;
uint64_t requestCount;
std::optional<std::string> serverName;
2023-11-23 19:57:32 +00:00
Router router;
2023-12-07 20:32:43 +00:00
std::unique_ptr<DBInterface> db;
2023-11-21 22:19:08 +00:00
};