Repository navigation
Expand file tree
/
Copy pathproject.js
More file actions
43 lines (37 loc) · 1.48 KB
/
Copy pathproject.js
File metadata and controls
43 lines (37 loc) · 1.48 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
var fs = require("fs");
var path = __dirname + "/" + "resource/local_data/"
module.exports = function(app) {
app.get('/project/list', function (req, res) {
fs.readFile( path + "project_list.json", 'utf8', function (err, data) {
// console.log( data );
// 发送 HTTP 头部
// HTTP 状态值: 200 : OK
// 内容类型: application/json
res.writeHead(200, {'Content-Type': 'application/json;charset=UTF-8',
'Accept': '*/*'});
res.end( data );
});
})
app.get('/project/detail', function (req, res) {
fs.readFile( path + "detail.json", 'utf8', function (err, data) {
// console.log( data );
// 发送 HTTP 头部
// HTTP 状态值: 200 : OK
// 内容类型: application/json
res.writeHead(200, {'Content-Type': 'application/json;charset=UTF-8',
'Accept': '*/*'});
res.end( data );
});
})
app.get('/group/list', function (req, res) {
fs.readFile( path + "group_list.json", 'utf8', function (err, data) {
// console.log( data );
// 发送 HTTP 头部
// HTTP 状态值: 200 : OK
// 内容类型: application/json
res.writeHead(200, {'Content-Type': 'application/json;charset=UTF-8',
'Accept': '*/*'});
res.end( data );
});
})
}