-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbasic.html
More file actions
70 lines (64 loc) · 2.78 KB
/
basic.html
File metadata and controls
70 lines (64 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html>
<head>
<title>basic.py</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="dycco.css">
</head>
<body>
<div id="container">
<div id="background"></div>
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th class="docs">
<h1>basic.py</h1>
</th>
<th class="code">
</th>
</tr>
</thead>
<tbody>
<tr id="section-2">
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-2">¶</a>
</div>
<p>A one-function WebCore 2 demonstration application.</p>
<p>Applications can be as simple or as complex and layered as your needs dictate.</p>
</td>
<td class="code">
<div class="highlight"><pre>
</pre></div>
</td>
</tr>
<tr id="section-8">
<td class="docs">
<div class="pilwrap">
<a class="pilcrow" href="#section-8">¶</a>
</div>
<p>Say hello.</p>
<p>This can be tested easily using cURL from the command line:</p>
<pre><code> curl http://localhost:8080/ # Default value via GET.
curl http://localhost:8080/Alice # Positionally specified via GET.
curl -d name=Eve http://localhost:8080/ # Form-encoded value via POST.
</code></pre>
</td>
<td class="code">
<div class="highlight"><pre><span class="k">def</span> <span class="nf">basic</span><span class="p">(</span><span class="n">context</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="s">"world"</span><span class="p">):</span>
<span class="k">return</span> <span class="s">"Hello {name}."</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">)</span>
<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">'__main__'</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">web.core</span> <span class="kn">import</span> <span class="n">Application</span>
<span class="n">Application</span><span class="p">(</span><span class="n">basic</span><span class="p">)</span><span class="o">.</span><span class="n">serve</span><span class="p">(</span><span class="s">'waitress'</span><span class="p">)</span>
</pre></div>
</td>
</tr>
</tbody>
</table>
<footer>
Generated by <b><a href="http://mccutchen.github.com/dycco/">Dycco</a></b>.
Last updated <b>25 Apr 2016</b>.
</footer>
</div>
</body>
</html>