Created
June 12, 2014 16:18
-
-
Save wbyoung/e1100107de0c295e35cd to your computer and use it in GitHub Desktop.
Simple static server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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