From 5ff3d7a51be30a0052b12f9330fdf54f3c104739 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Fri, 1 Oct 2021 17:59:24 +0200 Subject: Added Markdown and Static content module. Signed-off-by: Toni Uhlig --- src/content/static/Static.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/content/static/Static.cpp (limited to 'src/content/static/Static.cpp') 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 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; +} -- cgit v1.2.3