forked from jayli/nodejs-kissy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·32 lines (26 loc) · 756 Bytes
/
cli.js
File metadata and controls
executable file
·32 lines (26 loc) · 756 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
#!/usr/bin/env node
var yui3 = require('yui3-core');
process.chdir(yui3.path() + '/api/');
console.log(yui3.path());
try {
var express = require('express');
} catch (e) {
console.log('Could not require expressjs; install via: npm install express');
process.exit();
}
var args = process.argv.slice(2),
arg, key, config = { port: 8100 };
while (arg = args.shift()) {
if ("--" === arg.substr(0, 2)) {
key = arg.substr(2).split('=');
config[key[0]] = key[1];
}
}
var app = express.createServer();
app.configure(function() {
app.use(express.staticProvider(process.cwd()));
});
var port = parseInt(config.port);
app.listen(port);
console.log('YUI3 API Docs are available:');
console.log('http://localhost:' + port);