VWeb/Source/Route.cpp

30 lines
1.2 KiB
C++
Raw Permalink Normal View History

#include "Includes/VWeb.h"
2022-08-23 14:13:21 +02:00
#include <algorithm>
2022-08-23 14:13:21 +02:00
namespace VWeb {
2022-09-10 15:09:18 +02:00
bool Route::Execute(Request &request, Response &response) {
2022-08-23 14:13:21 +02:00
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);
}
}
2024-02-04 13:52:08 +01:00
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; }
2022-09-10 15:09:18 +02:00
bool Route::IsAllowed(Request &request) { return true; }
2024-02-04 13:52:08 +01:00
void Route::SetAllowedMethods(const uint32_t methods) {
m_AllowedMethods = methods;
2022-08-23 16:40:57 +02:00
}
2024-02-04 13:52:08 +01:00
uint32_t Route::GetAllowedMethods() const { return m_AllowedMethods; }
2022-11-09 14:34:20 +01:00
} // namespace VWeb