Skip to content

Instantly share code, notes, and snippets.

@davymacca
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save davymacca/a96c3b3b88b842cf2c88 to your computer and use it in GitHub Desktop.

Select an option

Save davymacca/a96c3b3b88b842cf2c88 to your computer and use it in GitHub Desktop.
Really simple node server for serving static files.
// A really simple node server for serving static files
//
// : To install
// $ npm install express
// $ npm install morgan
//
//
// : To Run
// node simple-server.js
// put your static files in /public/ directory
var express = require( 'express' ),
morgan = require( 'morgan' ),
server = express(),
staticPath = __dirname + '/public/',
port = 3000;
server.use( morgan('dev') );
server.use( express.static(staticPath) );
server.listen( port );
console.log('Started Server on: http://localhost:' + port);
@ihart
Copy link

ihart commented May 29, 2014

Your indentation is incorrect.

@davymacca
Copy link
Author

So is your beard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment