-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added index.js, which is literally hardcoded to list my projects.
Edited README.md to include a link to the blog.
- Loading branch information
abe545
committed
Mar 11, 2014
1 parent
b4de1a2
commit a9c7cfc
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
var https = require('https'); | ||
var http = require('http'); | ||
|
||
|
||
http.createServer(function(request, response) { | ||
console.log("Request handler 'codeplex' was called."); | ||
|
||
var options = { | ||
hostname: 'www.codeplex.com', | ||
path: '/api/users/aheidebrecht/projects', | ||
method: 'GET' | ||
}; | ||
|
||
var req = https.request(options, function(res) { | ||
var json = ''; | ||
res.on('data', function(d) { | ||
json += d; | ||
}); | ||
|
||
res.on('end', function() { | ||
var str = JSON.stringify(JSON.parse(json), null, " "); | ||
response.writeHead(200, { 'Content-Type': 'text/plain' }); | ||
response.write(str); | ||
response.end(); | ||
}); | ||
}); | ||
|
||
req.end(); | ||
|
||
req.on('error', function(err) { | ||
console.error(err); | ||
|
||
response.writeHead(500, { 'Content-Type': 'text/plain' }); | ||
response.write(err); | ||
response.end(); | ||
}); | ||
}).listen(999); |