patriot
Version:
Patriot command-line interface and node.js library.
38 lines (32 loc) • 779 B
JavaScript
/*!
* Module dependencies.
*/
var patriot = require('../main'),
console = require('./util/console');
/**
* $ patriot serve [options]
*
* Serves the app on a local web server.
*
* Options:
*
* - `argv` {Object} is an optimist object.
* - `callback` {Function} is a completion callback.
* - `e` {Error} is null unless there was an error.
*/
module.exports = function (argv, callback) {
// options
var data = {
port: argv.port || argv.p,
folder: argv.folder || argv.f
};
// run app command
var serve = patriot.serve(data, function (e, server) {
if (!e) {
console.log('');
console.log('ctrl-c to stop the server');
console.log('');
}
callback(e);
});
};