Skip to content

Instantly share code, notes, and snippets.

@silky
Forked from sordina/serve.js
Created June 19, 2014 10:41
Show Gist options
  • Save silky/51aa8a71884ab2d56dbc to your computer and use it in GitHub Desktop.
Save silky/51aa8a71884ab2d56dbc to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
// npm install connect
var port = process.argv[2];
var cwd = process.cwd();
if(! port) {
throw("Usage: serve <port>");
}
console.log("port " + port);
console.log("dir " + cwd);
var connect = require('connect');
var app = connect()
.use(connect.logger('dev'))
.use(connect.static(cwd))
connect.createServer( app ).listen(port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment