Diff between 854418938465dc7ace4d82d92179114e5ea5e496 and 2d9c9a72970f6f56aff747ced5d0800633d8e947

Changed Files

File Additions Deletions Status
src/main.cpp +7 -1 modified
templates/index.html +13 -0 added

Full Patch

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 @@
+<!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>