Skip to content

Instantly share code, notes, and snippets.

@gld1982ltd
Forked from nariatan/server.js
Last active January 20, 2016 04:25
Show Gist options
  • Save gld1982ltd/6944f88f8210e675cf83 to your computer and use it in GitHub Desktop.
Save gld1982ltd/6944f88f8210e675cf83 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
var livereload = require('livereload');
var 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