Skip to content

Instantly share code, notes, and snippets.

@nariatan
Created December 1, 2015 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nariatan/568ec48ca6e77eab2097 to your computer and use it in GitHub Desktop.
Save nariatan/568ec48ca6e77eab2097 to your computer and use it in GitHub Desktop.
Simple node.js server (livereload)
/*
* 1) run node server.js in root category where installed node
* 2) install browser extention
* 3) http://localhost:3000/index.html
*/
//server settings
var serveStatic = require('serve-static');
var connect = require('connect');
var http = require('http');
var app = connect();
app.use(serveStatic(__dirname));
//livereload
livereload = require('livereload');
server = livereload.createServer();
server.watch(__dirname);
http.createServer(app).listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment