-
Notifications
You must be signed in to change notification settings - Fork 0
/
sampleApp.html
69 lines (60 loc) · 1.86 KB
/
sampleApp.html
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
<!DOCTYPE html>
<html>
<head>
<title>Simple sample app to test page.js-body-parser.js</title>
<meta charset='UTF-8'>
</head>
<body>
<ul>
<li><a href='/testlink'>/testlink (test of a regular link)</a></li>
</ul>
<form action='/bodytest' method='post'>
<fieldset>
<legend>body test</legend>
<dl>
<dt><label for='textbox'>text box:</label></dt>
<dd><input type='text' name='textbox' id='textbox'></dd>
<dt><label for='checkbox'>checkbox:</label></dt>
<dd><input type='checkbox' name='checkbox' id='checkbox'></dd>
<dt><label>radios:</label></dt>
<dd>
<ul class='radios'>
<li><input type='radio' name='radios' value='one'> one</li>
<li><input type='radio' name='radios' value='two'> two</li>
<li><input type='radio' name='radios' value='three'> three</li>
</ul>
</dd>
</dl>
<div class='actions'>
<input type='submit' name='submit' value='Submit'>
</div>
</fieldset>
</form>
<p><em>Note: this can only be run from a web server. If you have Python installed, you can start a quick one by running "<code>python -m SimpleHTTPServer</code>" and then going to <a href='http://localhost:8000/sampleApp.html'>http://localhost:8000/sampleApp.html</a>.</em></p>
<!--
make sure to run:
bower install page.js
-->
<script src='bower_components/page.js/page.js'></script>
<!--
load body-parser plugin
-->
<script src='page.js-body-parser.js'></script>
<!--
sample app code
-->
<script>
// define routes
page('/testlink', function(req) {
console.log(req.body);
});
page('/bodytest', function(req) {
console.log(req.body);
});
// activate router
page();
// activate body-parser plugin
pageBodyParser();
</script>
</body>
</html>