VWeb/Source/Route.cpp

30 lines
1.2 KiB
C++

#include "Includes/VWeb.h"
#include <algorithm>
namespace VWeb {
bool Route::Execute(Request &request, Response &response) {
switch (request.Method) {
case HttpMethod::GET:
case HttpMethod::HEAD: return Get(request, response);
case HttpMethod::POST: return Post(request, response);
case HttpMethod::PUT: return Put(request, response);
case HttpMethod::PATCH: return Patch(request, response);
case HttpMethod::DELETE: return Delete(request, response);
default: return Fallback(request, response);
}
}
bool Route::Get(Request &request, Response &response) { return true; }
bool Route::Post(Request &request, Response &response) { return true; }
bool Route::Put(Request &request, Response &response) { return true; }
bool Route::Patch(Request &request, Response &response) { return true; }
bool Route::Delete(Request &request, Response &response) { return true; }
bool Route::Fallback(Request &request, Response &response) { return true; }
bool Route::IsAllowed(Request &request) { return true; }
void Route::SetAllowedMethods(const uint32_t methods) {
m_AllowedMethods = methods;
}
uint32_t Route::GetAllowedMethods() const { return m_AllowedMethods; }
} // namespace VWeb