aboutsummaryrefslogtreecommitdiff
path: root/src/content/static/Static.cpp
blob: 5e38b761b853b4d86b845c1c015228030cadb3b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "Static.hpp"

Static::Static(std::string uriBasePath, std::string staticFilesPath)
    : Content(), m_UriBasePath(uriBasePath), m_MainTemplatePath(""), m_StaticFilesPath(staticFilesPath)
{
}

bool Static::Init()
{
    std::cout << "Static files path: " << m_StaticFilesPath << std::endl;

    std::vector<std::string> extensions = {"json"};

    if (m_StaticFiles.Scan(m_StaticFilesPath, extensions, false) == false)
    {
        return false;
    }

    return true;
}

void Static::Shutdown()
{
    std::cout << "Static files module shutdown" << std::endl;
}

bool Static::Render(RequestResponse & rr, RenderData & rd, std::string & out)
{
    (void)rr;
    (void)rd;
    (void)out;

    rd["blah"] = "Yooooh!";

    return true;
}

std::string const & Static::GetUriBasePath() const
{
    return m_UriBasePath;
}

std::string const & Static::GetMainTemplate() const
{
    return m_MainTemplatePath;
}

Redirections const & Static::GetRedirections() const
{
    return m_Redirections;
}