-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.js
More file actions
executable file
·53 lines (45 loc) · 1.18 KB
/
test.js
File metadata and controls
executable file
·53 lines (45 loc) · 1.18 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
var mock = require('./index');
// redirect localhost/note/** to bd.liandong.org/blog
// the request response by the back-end-proxy
var proxyConfig = {
host: 'bd.liandong.org',
port: 80,
path: ['/project'],
// cookie: {name:'linkwisdom'},
replace: [
{source: '/project/114', target: '/project/114'}
]
};
var config = {
service: 'getFile',
port: 8087,
dir: './',
proxy: proxyConfig
};
mock.startServer(config);
/**
* -------------------------------------------------
* for fc test
* -------------------------------------------------
* proxy bd.liandong.org/bloc with localhost/note/
*
* query *.css and the according *.less file;
*
* when *.ajax query, redirect it to the php file
*
* -------------------------------------------------
*/
var option = {
location: /\/note/,
handler: mock.proxy(
{
host: 'bd.liandong.org',
port: 80,
replace: [
{source: 'note/', target: 'blog/'},
{source: /\.ajax$/g, target: '.php'},
{source: /\.css$/g, target: '.less'}
]
}
)
};