Skip to content

Instantly share code, notes, and snippets.

@mhayes mhayes/README.md
Created Oct 4, 2013

Embed
What would you like to do?
Start a simple web server from the current directory by running `s` in terminal!

Quickstart

Setup

  1. Place s in /usr/local/bin/s
  2. Run chmod +x /usr/local/bin/s

Usage

Let's assume you have a static site setup in ~/Sites/awesomeapp. Open up terminal and run the following commands:

cd ~/Sites/awesomeapp
s

That's it!

#!/usr/bin/env node
var connect = require('connect'),
path = require('path'),
http = require('http'),
exec = require('child_process').exec,
DEFAULT_PORT = 8080;
var cwd = process.cwd();
var app = connect()
.use(connect.logger('dev'))
.use(connect.static(cwd));
http.createServer(app).listen(DEFAULT_PORT);
console.info('Server started at http://localhost:' + DEFAULT_PORT + '/')
exec("open http://localhost:" + DEFAULT_PORT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.