blob: 314d2bfa371faacc5dd433f4008236485b58354c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include "config.hpp"
#include "crow/app.h"
#include "crow/mustache.h"
#include "handlers.hpp"
int main(int argc, char *argv[]) {
auto cfg = botweb::parse_configuration_from_file(".env");
crow::SimpleApp app;
CROW_ROUTE(app, "/")
([&cfg]() {
auto page = crow::mustache::load("index.html");
crow::mustache::context ctx;
ctx["contact_url"] = (*cfg).contact_url;
ctx["contact_name"] = (*cfg).contact_name;
return page.render(ctx);
});
CROW_ROUTE(app, "/wiki")
([&cfg]() { return botweb::get_wiki_page("/README", cfg); });
CROW_ROUTE(app, "/wiki/<path>")
([&cfg](const std::string &path) {
return botweb::get_wiki_page(path, cfg);
});
app.multithreaded().port(18083).run();
return 0;
}
|