Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node app.js
52 changes: 29 additions & 23 deletions app.js
Original file line number Diff line number Diff line change
@@ -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 = "<html><head></head><body>"
request.get(url, function (err, body, response) {
var datas = "<html><head></head><body>";

request.get(url, function (err,body,result) {

//~~~~~~~~~~~~~
result = JSON.parse(result);
result.data.forEach(function (val,idx) {
if (val.comments != null){
datas += "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">"
datas += "<img src ='" + val.images[5].source + "'><br>";
val.comments.data.forEach(function (tt,idx){

datas += "<h3 style=\"color: blue \">" + tt.from.name + "</h3>";
datas += "<p> " + tt.message + "</p>";
//console.log(datas);
});
}

response = JSON.parse(response);
response.data.forEach(function (val, idx) {
data += "<img src='" + val.images[2].source + "'>";
});

data += "</body></html>";
res.end(data);
datas += result;
res.end(datas);
});

datas += "</body></html>";
console.log("run");
}).listen(port);

console.log("start server port: " + port);

console.log("Server Created\nPort Number : "+port);

2 changes: 2 additions & 0 deletions test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test
weifjw