feat: implement basic server

This demo can:
- Serve a webpage
- Serve static assets
- Asynchronously fetch html
This commit is contained in:
2023-05-09 20:56:09 +02:00
parent 351d6d2f64
commit ea59f1ed1e
10 changed files with 1778 additions and 2 deletions

View File

View File

@@ -0,0 +1,8 @@
<thead>
<tr><th>foo</th><th>bar</th><th>baz</th></tr>
</thead>
<tbody>
{% for row in table %}
<tr><td>{{ row.foo }}</td><td>{{ row.bar }}</td><td>{{ row.baz }}</td></tr>
{% endfor %}
</tbody>

28
templates/layout.html Normal file
View File

@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/static/css/style.css" />
<script src="/static/js/htmx.min.js"></script>
<script src="/static/js/script.js"></script>
<title>Hello htmx!</title>
</head>
<body>
<hgroup>
<h1>Hello htmx!</h1>
<p>A new old way to build web applications</p>
</hgroup>
<table>
<tr><td>
<button hx-get="/table" hx-target="table" hx-push-url="true">
Load data
</button>
</td></tr>
</table>
</body>
</html>

View File