function startServer(options) {

  options = initOptions(options);

  var app = connect()
    , root = options.root
    , TEST = process.env.TEST
    , isSilent = options.silent || TEST;

  if (!isSilent) {
    app.use(log);
  }

  var smOpts = {};
  var smOptMap = {
    ftpl: 'template'
    , style: 'style'
  };
  Object.keys(smOptMap).forEach(function (key) {
    if (options[key] !== undefined) smOpts[smOptMap[key]] = options[key];
  });

  // serve markdown file
  app.use(serveMarkdown(root, smOpts));
  // common files
  app.use(serveStatic(root, {index: ['index.html']}));

  // serve directory
  app.use(serveIndex(root, {
    icon: true
    , template: options.dtpl
    , stylesheet: options.style
    , view: options.view
  }));

  debug('server run in ' + (process.env.TEST ? 'TEST' : 'PRODUCTION') + ' mode')
  if (!TEST) {
    app.listen(options.port);
    showSuccessInfo(options);
  }

  return app;
}
function startServer(options) {

  options = initOptions(options);

  var app = connect()
    , root = options.root
    , TEST = process.env.TEST
    , isSilent = options.silent || TEST;

  if (!isSilent) {
    app.use(log);
  }

  var smOpts = {};
  var smOptMap = {
    ftpl: 'template'
    , style: 'style'
  };
  Object.keys(smOptMap).forEach(function (key) {
    if (options[key] !== undefined) smOpts[smOptMap[key]] = options[key];
  });

  // serve markdown file
  app.use(serveMarkdown(root, smOpts));
  // common files
  app.use(serveStatic(root, {index: ['index.html']}));

  // serve directory
  app.use(serveIndex(root, {
    icon: true
    , template: options.dtpl
    , stylesheet: options.style
    , view: options.view
  }));

  debug('server run in ' + (process.env.TEST ? 'TEST' : 'PRODUCTION') + ' mode')
  if (!TEST) {
    app.listen(options.port);
    showSuccessInfo(options);
  }

  return app;
}
function startServer ( options ) { options = initOptions ( options ) ; var app = connect ( ) , root = options . root , TEST = process . env . TEST , isSilent = options . silent || TEST ; if ( ! isSilent ) { app . use ( log ) ; } var smOpts = { } ; var smOptMap = { ftpl : 'template' , style : 'style' } ; Object . keys ( smOptMap ) . forEach ( function ( key ) { if ( options [ key ] !== undefined ) smOpts [ smOptMap [ key ] ] = options [ key ] ; } ) ; // serve markdown file app . use ( serveMarkdown ( root , smOpts ) ) ; // common files app . use ( serveStatic ( root , { index : [ 'index.html' ] } ) ) ; // serve directory app . use ( serveIndex ( root , { icon : true , template : options . dtpl , stylesheet : options . style , view : options . view } ) ) ; debug ( 'server run in ' + ( process . env . TEST ? 'TEST' : 'PRODUCTION' ) + ' mode' ) if ( ! TEST ) { app . listen ( options . port ) ; showSuccessInfo ( options ) ; } return app ; }
start server with provided options
start server with provided options