#include "App.hpp" #include "../fw/Templates.hpp" namespace molo::example::app { namespace { const char kBase[] = R"BASE( {{ title }}
{{ site }}
{% block content %}{% endblock %}
)BASE"; const char kIndex[] = R"INDEX({% extends "base.html" %} {% block content %}

Living example

{{ feature_count }} features in {{ group_count }} groups, each one click away. Every row is a live route with a test behind it. Mobile-first: narrow the window and the top nav collapses into a dropdown menu.

{{ sections|safe }} {% include "nav_hint.html" %} {% endblock %} )INDEX"; const char kPage[] = R"PAGE({% extends "base.html" %} {% block content %}

{{ heading }}

Author: {{ author|upper }}

Raw (escaped): {{ snippet }}

Trusted (safe): {{ snippet|safe }}

{% endblock %} )PAGE"; const char kFormPage[] = R"FORM({% extends "base.html" %} {% block content %}

{{ title }}

{% if notice %}

{{ notice }}

{% endif %} {% if error_count %} {% endif %} {% if done %}{% else %}
{% for f in fields %}
{% if f.textarea %} {% else %} {% endif %} {% if f.hint %}{{ f.hint }}{% endif %} {% if f.error %}

{{ f.error }}

{% endif %}
{% endfor %}
{% endif %} {% endblock %} )FORM"; const char kStats[] = R"STATS({% extends "base.html" %} {% block content %}

Statistics

HTTP requests, connections, and service state of this running server. History is 15 minutes in 10 second buckets. The server stops accepting after its connection cap, so auto refresh is off by default.

loading...
Uptime-
Requests-
Errors-
Avg latency-
p95 latency-
p99 latency-
Bytes in-
Bytes out-
Connections-
Active-
Timeouts / malformed-
Connections left (cap)-

Traffic

Requests and errors per 10 s
Average latency per 10 s
Bytes in and out per 10 s
Connections opened per 10 s

Requests

Status codes
Methods
Latency distribution
Top routes

Services

Store sizes
Cache hits and misses
Tasks by state
ORM tables and rows
{% endblock %} )STATS"; const char kVoice[] = R"VOICE({% extends "base.html" %} {% block content %}

Voice conversation

Talk, pause, and the assistant answers out loud. Google speech-to-text, Gemini, and Google text-to-speech run on the server. Speak over the answer to interrupt it.

Checking Google credentials...

idle
    {% endblock %} )VOICE"; const char kDocs[] = R"DOCS({% extends "base.html" %} {% block content %}

    API docs

    OpenAPI JSON: /openapi.json

    {% endblock %} )DOCS"; const char kError[] = R"ERROR({% extends "base.html" %} {% block content %}

    Error {{ status }}

    {{ message }}

    {% endblock %} )ERROR"; const char kNavHint[] = "

    Tip: this page works on a 360px phone.

    \n"; } // namespace void load_templates(Services& services) { services.templates->add_template("base.html", kBase); services.templates->add_template("index.html", kIndex); services.templates->add_template("page.html", kPage); services.templates->add_template("form_page.html", kFormPage); services.templates->add_template("docs.html", kDocs); services.templates->add_template("voice.html", kVoice); services.templates->add_template("stats.html", kStats); services.templates->add_template("error.html", kError); services.templates->add_template("nav_hint.html", kNavHint); services.templates->add_global("site", "MoloApp living example"); services.templates->add_global("backend", "skeleton"); } } // namespace molo::example::app