Created
May 23, 2017 05:04
-
-
Save hackerdem/e08e3daa1f49f64aaead435603fb46ea to your computer and use it in GitHub Desktop.
simple server app with node.js
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
var express=require('express'); | |
var app=express(); | |
var fs=require('fs'); | |
app.get('/',function(req,res){ | |
fs.readFile('index.html',function(err,buffer){ | |
var html=buffer.toString(); | |
res.setHeader('Content-Type','text/html'); | |
res.send(html); | |
}); | |
}); | |
var port=3000; | |
app.listen(port,function(){ | |
console.log('listening on http://localhost:',port); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment