#include "BasicWebApp.h"

#include "FileLogger.h"

HttpResponse BasicWebApp::onHttpRequest(const HttpRequest& request)
{
    const auto url = request.getPath();

    HttpResponse response;
    if (request.getVerb() == HttpRequest::Verb::GET)
    {     
        MLOG_INFO("Got a GET request for: " << url);
        response.setBody("Hey! You hit the server \r\n");
        response.setStatusCode(200);
        response.setResponseReason("OK");
    }
    else if (request.getVerb() == HttpRequest::Verb::POST)
    {
        MLOG_INFO("Got a POST request for: " << url);
    }
    else
    {
        MLOG_INFO("Got an unknown request for: " << url);
        response.setStatusCode(503);
        response.setResponseReason("Not Implemented");
    }
    return response;
}