Added basic rest framework

This commit is contained in:
Leon Etienne (ubuntu wsl)
2020-09-24 14:31:30 +02:00
parent 918b735922
commit 595e04bc32
20 changed files with 429 additions and 318 deletions

25
Tubio/RestQueryHandler.h Normal file
View File

@@ -0,0 +1,25 @@
#pragma once
#include "JasonPP.hpp"
#include "RestResponseTemplates.h"
#include "XGControl.h"
#include "Logger.h"
namespace Rest
{
class RestQueryHandler
{
public:
static void PreInit();
static bool ProcessQuery(const JasonPP::Json& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode);
static void PostExit();
private:
static bool KillYourself(const JasonPP::JsonBlock& request, JasonPP::JsonBlock& responseBody, HTTP_STATUS_CODE& responseCode);
static bool ValidateField(const std::string name, const JasonPP::JSON_DATA_TYPE type, const JasonPP::Json& checkThat, JasonPP::JsonBlock& putErrorResponseHere);
static Logging::Logger* log;
};
}