diff --git a/src/main.cpp b/src/main.cpp
index 9cd7860..ba7cd0f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
//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
+<!DOCTYPE html>
+<html lang="fi">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Index</title>
+ </head>
+ <body>
+ {{#asunnot}}
+ <p>{{.}}</p>
+ {{/asunnot}}
+ </body>
+</html>