Skip to content

Instantly share code, notes, and snippets.

@wbyoung
Created June 12, 2014 16:18
Show Gist options
  • Save wbyoung/e1100107de0c295e35cd to your computer and use it in GitHub Desktop.
Save wbyoung/e1100107de0c295e35cd to your computer and use it in GitHub Desktop.
Simple static server
{
"name": "foursquare",
"version": "0.1.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "Whitney Young",
"license": "MIT",
"devDependencies": {
"connect": "^2.19.6",
"morgan": "^1.1.1",
"serve-static": "^1.2.3"
}
}
#!/usr/bin/env node
var args = process.argv.slice(2);
if (args.length !== 1) {
console.error('usage: %s port', process.argv[1]);
process.exit(1);
}
require('connect')()
.use(require('morgan')('dev'))
.use(require('serve-static')(__dirname))
.listen(args[0], function() {
console.log('server started on port %s', args[0]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment