feat: add very simple index page linking to my site
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
parent
22a7b5b3fc
commit
55474b485f
13
src/main.cpp
13
src/main.cpp
|
@ -7,6 +7,16 @@ extern "C" {
|
|||
#include "ternarytrie.h"
|
||||
}
|
||||
|
||||
static const std::string index_page = R"(
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<h1>r8r.be</h1>
|
||||
<p>This is the URL shortener and pastebin accompanying my site, <a href="https://rustybever.be">The Rusty Bever</a>.</p>
|
||||
</body>
|
||||
</html>
|
||||
)";
|
||||
|
||||
#define ENV(var, env_var) \
|
||||
const char *_##var = getenv(env_var); \
|
||||
if (_##var == NULL) { \
|
||||
|
@ -102,6 +112,9 @@ int main() {
|
|||
crow::SimpleApp app;
|
||||
app.loglevel(crow::LogLevel::Info);
|
||||
|
||||
CROW_ROUTE(app, "/").methods(crow::HTTPMethod::Get)(
|
||||
[]() { return crow::response("html", index_page); });
|
||||
|
||||
// Serve an entry
|
||||
CROW_ROUTE(app, "/<string>")
|
||||
.methods(crow::HTTPMethod::Get)(
|
||||
|
|
Loading…
Reference in New Issue