From 2d9c9a72970f6f56aff747ced5d0800633d8e947 Mon Sep 17 00:00:00 2001 From: Wisdurm Date: Thu, 20 Nov 2025 14:23:40 +0200 Subject: [PATCH] t --- src/main.cpp | 8 +++++++- templates/index.html | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 templates/index.html diff --git a/src/main.cpp b/src/main.cpp index 9cd7860..ba7cd0f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,7 +9,13 @@ int main() //define your endpoint at the root directory CROW_ROUTE(app, "/")([&asunnot](){ - return asunnot.at(0); + auto page = crow::mustache::load("index.html"); + crow::json::wvalue asunnotJson; + for (int i = 0; i < asunnot.size(); ++i) { + asunnotJson[i] = asunnot.at(i); + } + crow::mustache::context ctx({{"asunnot", asunnotJson}}); + return page.render(ctx); }); try diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..e5d3111 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,13 @@ + + + + + + Index + + + {{#asunnot}} +

{{.}}

+ {{/asunnot}} + + -- 2.47.3