-
Notifications
You must be signed in to change notification settings - Fork 0
/
sign.js
32 lines (32 loc) · 893 Bytes
/
sign.js
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
var http = require('http');
/**
* 接口转发
*/
exports.find = function(req,success){
var headers = req.headers;
headers.host = 'https://api.github.com';
var options = {
host: 'https://api.github.com',
path: '/repos/lcl-101/webpack-blog/issues',
method: 'GET',
headers: {
'Access-Control-Allow-Origin':'*',
'Access-Control-Allow-Methods':'GET',
'Access-Control-Allow-Headers':'X-Requested-With, Content-Type'
}
};
var req = http.request(options, function(res) {
console.log(res.on);
res.setEncoding('utf8');
console.log(234);
res.on('data', function (data) {
console.log(data);
var data = JSON.parse(data);
success(res,data);
});
});
req.on('error', function(e){
console.log("auth_user error: " + e.message);
});
req.end();
}