Skip to content

Instantly share code, notes, and snippets.

@hackerdem
Created May 23, 2017 05:04
Show Gist options
  • Save hackerdem/e08e3daa1f49f64aaead435603fb46ea to your computer and use it in GitHub Desktop.
Save hackerdem/e08e3daa1f49f64aaead435603fb46ea to your computer and use it in GitHub Desktop.
simple server app with node.js
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