diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2021-10-01 17:59:24 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2021-10-01 17:59:24 +0200 |
commit | 5ff3d7a51be30a0052b12f9330fdf54f3c104739 (patch) | |
tree | 07f6780c4196205fe70b4caf6486b13fba80e30f /src/content/static/Static.cpp | |
parent | 2186064e52ec4029fd060323b51de973da4cee5f (diff) |
Added Markdown and Static content module.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/content/static/Static.cpp')
-rw-r--r-- | src/content/static/Static.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/content/static/Static.cpp b/src/content/static/Static.cpp new file mode 100644 index 0000000..5e38b76 --- /dev/null +++ b/src/content/static/Static.cpp @@ -0,0 +1,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; +} |