forked from kissjs/siege.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsiege_server.js
More file actions
34 lines (23 loc) · 726 Bytes
/
siege_server.js
File metadata and controls
34 lines (23 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var http = require('http')
, path = require('path')
, program = require('commander')
// jade options
var options = {};
// options
program
.version('0.0.1')
.usage('[options] [dir|file ...]')
.option('-p, --port <str>', 'filename used to resolve includes')
program.on('--help', function(){
console.log('');
});
program.parse(process.argv);
var APP = program.args[0]
var PORT = program.port
console.log('starting siege_server %s', APP)
if(!APP || !PORT) throw new Error('node siege_server.js --port port app.js')
var app = require(APP)
if(!app) throw new Error('app not found, ' + APP)
console.log('try to listen at %s', PORT);
http.createServer(app).listen(PORT)
console.log('server listen at %s', PORT)