Comparing version 0.3.1 to 0.3.2
@@ -0,1 +1,3 @@ | ||
#! /usr/bin/env node | ||
var path = require('path'), | ||
@@ -201,1 +203,20 @@ fs = require('fs'), | ||
}; | ||
if(!module.parent) { | ||
var http = require('http'), | ||
opts = require('optimist').argv, | ||
port = opts.port || opts.p || 8000, | ||
dir = opts.root || opts._[0] || process.cwd(); | ||
if(opts.help || opts.h) { | ||
var u = console.error | ||
u('usage: ecstatic [dir] {options} --port PORT') | ||
u('see https://npm.im/ecstatic for more docs') | ||
return | ||
} | ||
http.createServer(ecstatic(dir, opts)) | ||
.listen(port, function () { | ||
console.log('ecstatic serving ' + dir + ' on port ' + port); | ||
}); | ||
} |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple static file server middleware that works with both Express and Flatiron", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"homepage": "https://github.com/jesusabdullah/node-ecstatic", | ||
@@ -16,3 +16,4 @@ "repository": { | ||
}, | ||
"keywords" : [ | ||
"bin": "./lib/ecstatic.js", | ||
"keywords": [ | ||
"static", | ||
@@ -29,12 +30,13 @@ "web", | ||
"dependencies": { | ||
"mime" : "1.2.7", | ||
"ent" : "0.0.x" | ||
"mime": "1.2.7", | ||
"ent": "0.0.x", | ||
"optimist": "~0.3.5" | ||
}, | ||
"devDependencies": { | ||
"tap" : "0.3.x", | ||
"request" : "2.12.x", | ||
"express" : "3.0.x", | ||
"union" : "0.3.x", | ||
"tap": "0.3.x", | ||
"request": "2.12.x", | ||
"express": "3.0.x", | ||
"union": "0.3.x", | ||
"mkdirp": "0.3.x" | ||
} | ||
} |
@@ -122,2 +122,10 @@ # Ecstatic [![build status](https://secure.travis-ci.org/jesusabdullah/node-ecstatic.png)](http://travis-ci.org/jesusabdullah/node-ecstatic) | ||
### `ecstatic` command | ||
to start a standalone static http server, | ||
run `npm install -g ecstatic` and then run `ecstatic [dir?] [options] --port PORT` | ||
all options work as above, passed in [optimist](https://github.com/substack/optimist) style. | ||
`port` defaults to `8000`. If a `dir` or `--root dir` argument is not passed, ecsatic will | ||
serve the current dir. | ||
# Tests: | ||
@@ -124,0 +132,0 @@ |
222991
789
137
3
6
+ Addedoptimist@~0.3.5
+ Addedoptimist@0.3.7(transitive)
+ Addedwordwrap@0.0.3(transitive)