Skip to content

Commit dfdcc9f

Browse files
committed
feat: add curl hint for streaming /time endpoint in basic example
1 parent 1f9f897 commit dfdcc9f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

examples/basic.nu

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
match $req.path {
77
# Home page
88
"/" => {
9-
"<html><body>
9+
let proto = if ($req.proto | str starts-with "HTTP") { "http" } else { "https" }
10+
let base = $"($proto)://($req.headers.host)($req.mount_prefix? | default '')"
11+
$"<html><body>
1012
<h1>http-nu demo</h1>
1113
<ul>
1214
<li><a href='./hello'>Hello World</a></li>
1315
<li><a href='./json'>JSON Example</a></li>
1416
<li><a href='./echo'>POST Echo</a></li>
15-
<li><a href='./time'>Current Time</a></li>
17+
<li><a href='./time'>Current Time</a> -- streams text/plain; browsers buffer this.
18+
<br>Try: <code>curl -s ($base)/time</code></li>
1619
<li><a href='./info'>Request Info</a></li>
1720
</ul>
1821
</body></html>"

0 commit comments

Comments
 (0)