UNPKG

1.54 kBJavaScriptView Raw
1exports.port = 8848;
2exports.directoryIndexes = true;
3exports.documentRoot = __dirname;
4exports.getLocations = function () {
5 return [
6 {
7 location: /\.php$/,
8 handler: php()
9 },
10 {
11 location: /\/$/,
12 handler: home( 'index.html' )
13 },
14 {
15 location: /^\/redirect-local/,
16 handler: redirect('redirect-target', false)
17 },
18 {
19 location: /^\/redirect-remote/,
20 handler: redirect('http://www.baidu.com', false)
21 },
22 {
23 location: /^\/redirect-target/,
24 handler: content('redirectd!')
25 },
26 {
27 location: '/empty',
28 handler: empty()
29 },
30 {
31 location: /\.css($|\?)/,
32 handler: [
33 autoless()
34 ]
35 },
36 /*
37 {
38 location: /\.gif/,
39 handler: [
40 file(),
41 addRequestHeader({'Host': 'www.baidu.com'}),
42 proxy("www.baidu.com")
43 ]
44 },
45 */
46 {
47 location: /\.less($|\?)/,
48 handler: [
49 file(),
50 less()
51 ]
52 },
53 {
54 location: /^.*$/,
55 handler: [
56 file(),
57 proxyNoneExists()
58 ]
59 }
60 ];
61};
62
63exports.injectResource = function ( res ) {
64 for ( var key in res ) {
65 global[ key ] = res[ key ];
66 }
67};