-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·34 lines (26 loc) · 779 Bytes
/
index.js
File metadata and controls
executable file
·34 lines (26 loc) · 779 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
#! /usr/bin/env node
var program = require('commander');
var Interfake = require('./lib/server');
var packageInfo = require('./package.json');
program
.version(packageInfo.version)
.option('-f, --file [file]', 'Load an API from a JSON file [file]')
.option('-p --port [port]', 'Specify a port for Interfake to listen on', 3000)
.option('-d --debug', 'Debug mode, turns on console messages')
.option('-w --watch', 'If a loaded file changes, it will be re-loaded')
.parse(process.argv);
// console.log(program.args[0]);
var opts = {
debug: false
};
if (program.debug) {
opts.debug = true;
}
if (program.watch) {
opts.watch = true;
}
var interfake = new Interfake(opts);
if (program.file) {
interfake.loadFile(program.file, opts);
}
interfake.listen(program.port);