diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..207d22f --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: node app.js \ No newline at end of file diff --git a/app.js b/app.js index fa1a400..ae5b777 100644 --- a/app.js +++ b/app.js @@ -1,32 +1,38 @@ -/** - * @overview - * - * @author - * @version 2014/04/26 - */ - var http = require("http"); -var port = 1337; var request = require("request"); -var url = "http://graph.facebook.com/Boo/photos?type=uploaded"; +var port = Number(process.env.PORT || 3000); // to deploy on Heroku!!!!!!!~~~~~~~~ + +var url = "https://graph.facebook.com/2014.hsnu.at.ntu/photos?type=uploaded"; +//JSON is a global module not need to require// + + +http.createServer (function(req, res) { -http.createServer(function (req, res) { - res.writeHeader(200, {"Content-Type": "text/html"}); - // res.setHeader("Content-Type", "text/html"); - var data = "
" - request.get(url, function (err, body, response) { + var datas = ""; + + request.get(url, function (err,body,result) { + + //~~~~~~~~~~~~~ + result = JSON.parse(result); + result.data.forEach(function (val,idx) { + if (val.comments != null){ + datas += "" + datas += "" + tt.message + "
"; + //console.log(datas); + }); + } - response = JSON.parse(response); - response.data.forEach(function (val, idx) { - data += "