@@ -13,31 +13,22 @@ exports.install = function() {
13
13
14
14
// route: all txt files
15
15
// Try: http://127.0.0.4/test.txt
16
- F . file ( 'All *.txt' , static_txt ) ;
16
+ F . file ( '*.txt' , static_txt ) ;
17
17
18
18
// route: all jpg files
19
19
// all images will resized about 50%
20
20
// Try: http://127.0.0.4/header.jpg
21
- F . file ( 'All *.jpg' , static_jpg ) ;
21
+ F . file ( '*.jpg' , static_jpg ) ;
22
22
}
23
23
24
- function static_txt ( req , res , isValidation ) {
25
-
26
- if ( isValidation )
27
- return req . extension === 'txt' ;
28
-
29
- // generate response
24
+ function static_txt ( req , res ) {
25
+ // responds
30
26
// this === framework
31
- // Documentation: http://docs.totaljs.com/Framework/#framework.responsContent
32
27
res . content ( 200 , 'Server time: ' + new Date ( ) . toString ( ) , 'text/plain' ) ;
33
28
}
34
29
35
- function static_jpg ( req , res , isValidation ) {
36
-
37
- if ( isValidation )
38
- return req . extension === 'jpg' ;
39
-
40
- // generate response
30
+ function static_jpg ( req , res ) {
31
+ // responds
41
32
// this === framework
42
33
res . image ( F . path . public ( req . url ) , function ( image ) {
43
34
// image === FrameworkImage
@@ -51,7 +42,7 @@ function view_homepage(category) {
51
42
52
43
category = category || '' ;
53
44
54
- if ( category . length > 0 )
45
+ if ( category . length )
55
46
category = ' -> ' + category ;
56
47
57
48
this . plain ( 'homepage{0}' . format ( category ) ) ;
@@ -66,10 +57,10 @@ function view_products(category, subcategory) {
66
57
category = category || '' ;
67
58
subcategory = subcategory || '' ;
68
59
69
- if ( category . length > 0 )
60
+ if ( category . length )
70
61
category = ' -> ' + category ;
71
62
72
- if ( subcategory . length > 0 )
63
+ if ( subcategory . length )
73
64
subcategory = ' -> ' + subcategory ;
74
65
75
66
this . plain ( 'products{0}{1}' . format ( category , subcategory ) ) ;
0 commit comments