Crow/examples/example_blueprint.cpp

38 lines
714 B
C++
Raw Normal View History

#include "crow.h"
int main()
{
crow::SimpleApp app;
crow::Blueprint bp("bp_prefix", "cstat", "ctemplate");
2021-07-27 07:52:49 +00:00
crow::Blueprint sub_bp("bp2", "csstat", "cstemplate");
CROW_BP_ROUTE(sub_bp, "/")
([]() {
return "Hello world!";
});
/* CROW_BP_ROUTE(bp, "/templatt")
([]() {
crow::mustache::context ctxdat;
ctxdat["messg"] = "fifty five!!";
auto page = crow::mustache::load("indks.html");
return page.render(ctxdat);
});
*/
CROW_BP_CATCHALL_ROUTE(sub_bp)
([]() {
return "WRONG!!";
});
2021-07-27 07:52:49 +00:00
bp.register_blueprint(sub_bp);
app.register_blueprint(bp);
app.loglevel(crow::LogLevel::Debug).port(18080).run();
}