File tree Expand file tree Collapse file tree 3 files changed +16
-18
lines changed Expand file tree Collapse file tree 3 files changed +16
-18
lines changed Original file line number Diff line number Diff line change 1
- function myserver() % called from C
1
+ function myserver() % called on every page request
2
2
3
3
switch (webserver .url())
4
4
case ' /'
5
- stllog (' in /' )
5
+ stl .log (' in /' )
6
6
webserver .html(' home here' );
7
- case ' /bob'
8
- % webserver.template('templates/home.html', values);
9
- stllog(' in /bob' );
7
+ case ' /page1'
8
+ stl .log(' in /page1' );
10
9
if webserver .isGET()
11
- stllog (' GET request' );
10
+ stl .log (' GET request' );
12
11
end
13
12
a = webserver .getarg(' a' );
14
13
if ~isempty(a )
15
- stllog (' a = %s ' , cstring(a ));
14
+ stl .log (' a = %s ' , cstring(a ));
16
15
end
17
- webserver .html(' <html><body>hello <b>from</b> /bob </body></html>' );
18
- case ' /alice '
19
- stllog (' in /alice ' )
16
+ webserver .html(' <html><body>hello <b>from</b> /page1 </body></html>' );
17
+ case ' /page2 '
18
+ stl .log (' in /page2 ' )
20
19
vals.a = 1 ;
21
20
vals.b = 2 ;
22
- webserver .template(' templates/alice .html' , vals );
21
+ webserver .template(' templates/page2 .html' , vals );
23
22
case ' /duck'
24
23
webserver .file(' duck.jpg' , ' image/jpeg' );
25
24
case ' /input'
26
25
if webserver .isPOST()
27
- stllog (' POST request' );
26
+ stl .log (' POST request' );
28
27
foo = webserver .postarg(' Foo' );
29
- stllog (' foo = %s ' , cstring(foo ));
28
+ stl .log (' foo = %s ' , cstring(foo ));
30
29
else
31
- stllog (' GET request' );
30
+ stl .log (' GET request' );
32
31
end
33
32
webserver .template(' templates/input.html' );
34
- end
35
-
33
+ end
36
34
end
File renamed without changes.
Original file line number Diff line number Diff line change 1
1
function user() % #codegen
2
2
3
- stllog (' user program starts' );
3
+ stl .log (' user program starts' );
4
4
5
5
webserver(8080 , ' myserver' );
6
6
7
- sleep(60 );
7
+ stl . sleep(60 );
8
8
end
You can’t perform that action at this time.
0 commit comments