1 |
|
2 |
|
3 | cli = require 'cli'
|
4 |
|
5 | cli.enable('daemon','status')
|
6 | .setUsage('static.coffee [OPTIONS]')
|
7 |
|
8 | cli.parse {
|
9 | log: ['l', 'Enable logging']
|
10 | port: ['p', 'Listen on this port', 'number', 8080]
|
11 | serve: [false, 'Serve static files from PATH', 'path', './public']
|
12 | }
|
13 |
|
14 | middleware = []
|
15 |
|
16 | cli.main (args, options) ->
|
17 |
|
18 | if options.log
|
19 | @debug 'Enabling logging'
|
20 | middleware.push require('creationix/log')()
|
21 |
|
22 | @debug 'Serving files from ' + options.serve
|
23 | middleware.push require('creationix/static')('/', options.serve, 'index.html')
|
24 |
|
25 | server = @createServer(middleware).listen options.port
|
26 |
|
27 | @ok 'Listening on port ' + options.port |
\ | No newline at end of file |