Switch to single page application #2

Merged
array-in-a-matrix merged 8 commits from hpx-spa into main 2024-01-08 21:04:02 -05:00
3 changed files with 9 additions and 5 deletions
Showing only changes of commit dc22440b42 - Show all commits

View file

@ -3297,4 +3297,3 @@ $$
</div></div> </div></div>
</body> </body>
</html> </html>

View file

@ -8,6 +8,10 @@ templateFolder("templates")
proc renderPage(title: string): string = proc renderPage(title: string): string =
renderTemplate("index.nimja") renderTemplate("index.nimja")
type httpErrors = object
code: string
# description: string
# ? Serve at http://127.0.0.1:5000 # ? Serve at http://127.0.0.1:5000
serve("127.0.0.1", 5000): serve("127.0.0.1", 5000):
@ -21,7 +25,8 @@ serve("127.0.0.1", 5000):
echo req echo req
notfound: notfound:
return renderPage("404") let error = httpErrors(code: "404")
return renderPage(error.code)
# make base articles and assets publicly accessible # make base articles and assets publicly accessible
staticDir "src/articles" staticDir "src/articles"

View file

@ -69,9 +69,9 @@
{% if title == "" %} {% if title == "" %}
{% elif title == "404" %} {% elif title == "404" %}
does not exist Page does not exist.
{% else %} {% else %}
<iframe class="w-full min-h-screen" src="/src/articles/{{title}}.html" seamless></iframe> <iframe class="w-full h-screen" src="/src/articles/{{title}}.html" seamless></iframe>
{% endif %} {% endif %}
</section> </section>