-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlive.js
50 lines (37 loc) · 1.1 KB
/
live.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var Promise = require('promise');
var request = require('request');
function getPosts(live_card_id){
var reqBody = {
url:"http://api.globalhack4.test.lockerdome.com/app_fetch_content?",
qs:{
"app_id":global.APP_ID,
"app_secret":global.APP_SECRET,
"content_id": live_card_id
},
method:'GET'
};
return "hello";
// return new Promise(function(success, fail){
// request(reqBody, function(error, response, body){
// if(error){
// fail(error);
// }else{
// success({response:response, body:body});
// }
// });
// });
}
var Live = function Live(){
//returns promise
this.display = function(req, res, next){
res.send(getPosts(42));
// getPosts(42).then(function(data){
// res.send(JSON.parse(data));
// });
}
}
var gLive;
if(!gLive){
gLive = new Live();
}
module.exports = gLive;