lib/server.js
function server() {
  // TODO: Show require express error
  var express = require('express')
    , app = express();

  app.configure(function() {
    app.use(express.static(siteBuilder.outputRoot));
    app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
  });

  // Map missing trailing slashes for posts
  app.get('*', function(req, res) {
    var postPath = siteBuilder.outputRoot + req.url + '/';
    // TODO: Security
    if (req.url.match(/[^/]$/) && existsSync(postPath)) {
      res.redirect(req.url + '/');
    } else {
      res.send('404');
    }
  });

  app.listen(siteBuilder.config.port);
  log.info('Listening on port', siteBuilder.config.port);
}
function server() {
  // TODO: Show require express error
  var express = require('express')
    , app = express();

  app.configure(function() {
    app.use(express.static(siteBuilder.outputRoot));
    app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
  });

  // Map missing trailing slashes for posts
  app.get('*', function(req, res) {
    var postPath = siteBuilder.outputRoot + req.url + '/';
    // TODO: Security
    if (req.url.match(/[^/]$/) && existsSync(postPath)) {
      res.redirect(req.url + '/');
    } else {
      res.send('404');
    }
  });

  app.listen(siteBuilder.config.port);
  log.info('Listening on port', siteBuilder.config.port);
}
function server ( ) { // TODO: Show require express error var express = require ( 'express' ) , app = express ( ) ; app . configure ( function ( ) { app . use ( express . static ( siteBuilder . outputRoot ) ) ; app . use ( express . errorHandler ( { dumpExceptions : true , showStack : true } ) ) ; } ) ; // Map missing trailing slashes for posts app . get ( '*' , function ( req , res ) { var postPath = siteBuilder . outputRoot + req . url + '/' ; // TODO: Security if ( req . url . match ( / [^/]$ / ) && existsSync ( postPath ) ) { res . redirect ( req . url + '/' ) ; } else { res . send ( '404' ) ; } } ) ; app . listen ( siteBuilder . config . port ) ; log . info ( 'Listening on port' , siteBuilder . config . port ) ; }
Instantiates and runs the Express server.
Instantiates and runs the Express server .