-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
40 lines (27 loc) · 804 Bytes
/
app.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
var http = require("http");
var port = Number(process.env.PORT || 3000);
var request = require("request");
var fs = require('fs');
var url = "http://graph.facebook.com/2014METEORmeethere/photos?type=uploaded"
var template = '';
/*
fs.readFile("./index.html","utf8", function (err,result){
template = result;
})
*/
template = fs.readFileSync("./index.html", "utf8");
http.createServer(function (req,res){
var data = "";
request.get(url, function(err, body, result){
result = JSON.parse(result);
result.data.forEach(function (val, idx){
data += "<img src='"+val.images[2].source+"'>";
})
data = template.replace("{{content}}",data);
// res.end(result);
res.end(data);
})
//console.log( "server hi");
//res.end(data);
}).listen(port);
console.log("server create :" + port);