We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1f9f897 commit dfdcc9fCopy full SHA for dfdcc9f
1 file changed
examples/basic.nu
@@ -6,13 +6,16 @@
6
match $req.path {
7
# Home page
8
"/" => {
9
- "<html><body>
+ 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>
12
<h1>http-nu demo</h1>
13
<ul>
14
<li><a href='./hello'>Hello World</a></li>
15
<li><a href='./json'>JSON Example</a></li>
16
<li><a href='./echo'>POST Echo</a></li>
- <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>
19
<li><a href='./info'>Request Info</a></li>
20
</ul>
21
</body></html>"
0 commit comments