Created
March 23, 2015 13:53
-
-
Save mattyod/3c3043abf0d1b44ae696 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
'use strict'; | |
var http = require('http'), | |
fs = require('fs'); | |
var filePath = './feeds/feed.json'; | |
http.createServer(function (req, res) { | |
var readStream; | |
fs.stat(filePath, function (err, stat) { | |
res.writeHead(200, { | |
'Content-Type': 'application/json', | |
'Content-Length': stat.size | |
}); | |
}); | |
readStream = fs.createReadStream(filePath); | |
readStream.pipe(res); | |
}).listen(7777); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment