30 lines
554 B
C++
30 lines
554 B
C++
//SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
|
|
//SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <memory>
|
|
|
|
#include "request/request.h"
|
|
#include "response/response.h"
|
|
|
|
namespace Handler {
|
|
|
|
class Handler {
|
|
protected:
|
|
Handler(const std::string& path, Request::Method method);
|
|
|
|
protected:
|
|
static void error (Request& request, Response::Status status);
|
|
|
|
public:
|
|
virtual ~Handler();
|
|
|
|
virtual void handle(Request& request) = 0;
|
|
|
|
const std::string path;
|
|
const Request::Method method;
|
|
};
|
|
}
|