aboutsummaryrefslogtreecommitdiff
path: root/examples/http-server/http-server.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-02 16:19:57 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-02 16:19:57 -0400
commit2685c4c31ffad356a73f1e0ec69606b6136bca47 (patch)
tree6f32c23cebbb6e83a2fff09f523ceac75c3a976c /examples/http-server/http-server.tm
parent639de3e5df6af1ed236cf1b849bbcf0894c7d8ad (diff)
Move HTML into script
Diffstat (limited to 'examples/http-server/http-server.tm')
-rw-r--r--examples/http-server/http-server.tm12
1 files changed, 1 insertions, 11 deletions
diff --git a/examples/http-server/http-server.tm b/examples/http-server/http-server.tm
index 4cdbda4e..f7338b91 100644
--- a/examples/http-server/http-server.tm
+++ b/examples/http-server/http-server.tm
@@ -106,17 +106,7 @@ enum RouteEntry(ServeFile(file:Path), Redirect(destination:Text)):
func respond(entry:RouteEntry, request:HTTPRequest -> HTTPResponse):
when entry is ServeFile(file):
body := if file:can_execute():
- output := Command(Text(file)):get_output()!
- "
- <!DOCTYPE HTML>
- <html>
- <head><title>$file</title></head>
- <body>
- <h1>$file program output</h1>
- <pre>$output</pre>
- </body>
- </html>
- "
+ Command(Text(file)):get_output()!
else:
file:read()!
return HTTPResponse(body, content_type=_content_type(file))