fkin finally
This commit is contained in:
15
include/errors.hpp
Normal file
15
include/errors.hpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef ERRORS_HPP
|
||||
#define ERRORS_HPP
|
||||
|
||||
#include <crow.h>
|
||||
#include "templating.hpp"
|
||||
|
||||
extern Templating templating;
|
||||
|
||||
struct CustomErrorHandler {
|
||||
struct context {};
|
||||
void before_handle(crow::request& req, crow::response& res, context&) {}
|
||||
void after_handle(crow::request& req, crow::response& res, context&);
|
||||
};
|
||||
|
||||
#endif
|
@@ -7,12 +7,19 @@
|
||||
|
||||
class Templating {
|
||||
public:
|
||||
Templating(const std::string& template_dir) : inja_env{template_dir} {}
|
||||
explicit Templating(const std::string& template_dir);
|
||||
|
||||
crow::response render_template(const std::string& template_name, const inja::json& data);
|
||||
crow::response render_template(const std::string& template_name);
|
||||
|
||||
std::string render_template_string(const std::string& template_name, const inja::json& data);
|
||||
std::string render_template_string(const std::string& template_name);
|
||||
|
||||
private:
|
||||
inja::Environment inja_env;
|
||||
std::string template_dir; // absolute path to templates
|
||||
|
||||
std::string preprocess_template(const std::string& template_name);
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user