diff --git a/examples/websocket/example_ws.cpp b/examples/websocket/example_ws.cpp index ec3603c29..e3c1b8590 100644 --- a/examples/websocket/example_ws.cpp +++ b/examples/websocket/example_ws.cpp @@ -33,8 +33,13 @@ int main() CROW_ROUTE(app, "/") ([]{ + char name[256]; + gethostname(name, 256); + crow::mustache::context x; + x["servername"] = name; + auto page = crow::mustache::load("ws.html"); - return page.render(); + return page.render(x); }); app.port(40080) diff --git a/examples/websocket/templates/ws.html b/examples/websocket/templates/ws.html index f6e72811c..5200b8b63 100644 --- a/examples/websocket/templates/ws.html +++ b/examples/websocket/templates/ws.html @@ -11,7 +11,7 @@