Last active
August 20, 2018 17:28
-
-
Save chaiwa-berian/8e1d60dc8e999817b9601164020b9169 to your computer and use it in GitHub Desktop.
Nodejs Streams
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
const http = require('http'); | |
const fs = require('fs'); | |
var server = http.createServer((req,res)=>{ | |
fs.readFile(__dirname + '/data.txt', function(err, data){ | |
if(err){ | |
res.end(err); | |
} | |
res.end(data); | |
} | |
}); | |
server.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment