VWeb/Includes/Route.h

34 lines
972 B
C
Raw Normal View History

#pragma once
#include "Http.h"
#include <initializer_list>
#include "Request.h"
#include "Response.h"
#include <vector>
namespace VWeb {
class Router;
class Route {
public:
Route() = default;
virtual ~Route() = default;
Route(std::initializer_list<HttpMethod>);
virtual bool Execute(Request &request, Response &response);
virtual bool Get(Request &request, Response &response);
virtual bool Post(Request &request, Response &response);
virtual bool Put(Request &request, Response &response);
virtual bool Patch(Request &request, Response &response);
virtual bool Delete(Request &request, Response &response);
bool Options(Request &request, Response &response);
virtual bool Fallback(Request &request, Response &response);
bool SupportsMethod(Request &request);
virtual bool IsAllowed(Request &request);
void AllowMethod(HttpMethod method);
protected:
bool m_AllowAll{true};
std::vector<HttpMethod> m_AllowedMethods;
friend Router;
};
}