mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
template indedx.html added
This commit is contained in:
parent
87c40f4e5a
commit
2b15f5d8ea
2 changed files with 23 additions and 7 deletions
11
main.cpp
11
main.cpp
|
@ -5,7 +5,7 @@
|
|||
#include "mstch/mstch.hpp"
|
||||
#include "ext/format.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using boost::filesystem::path;
|
||||
|
||||
|
@ -42,10 +42,9 @@ int main() {
|
|||
fmt::print("\n\n"
|
||||
"Top block height : {:d}\n", height);
|
||||
|
||||
std::string view {
|
||||
"Blockchain height {{height}}\n\n"
|
||||
"{{#blocks}}{{height}}: {{hash}} \n{{/blocks}}"
|
||||
};
|
||||
std::ifstream t("src/templates/index.html");
|
||||
std::string index_tmpl_str((std::istreambuf_iterator<char>(t)),
|
||||
std::istreambuf_iterator<char>());
|
||||
|
||||
mstch::map context {
|
||||
{"height", fmt::format("{:d}", height)},
|
||||
|
@ -73,7 +72,7 @@ int main() {
|
|||
|
||||
CROW_ROUTE(app, "/")
|
||||
([&]() {
|
||||
return mstch::render(view, context);
|
||||
return mstch::render(index_tmpl_str, context);
|
||||
});
|
||||
|
||||
app.port(8080).multithreaded().run();
|
||||
|
|
17
src/templates/index.html
Normal file
17
src/templates/index.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Monero blocks</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<h1>{{height}}</h1>
|
||||
<div>
|
||||
{{#blocks}}
|
||||
{{height}}: {{hash}}
|
||||
{{/blocks}}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue