diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -107,16 +107,17 @@ delete mocha_opt.reporter;
 
 // setup http server to serve our harness files
 var app = express();
+
+if (config.initApp) {
+    config.initApp(app, express);
+}
+
 app.use(app.router);
 
 if (argv.wwwroot) {
     app.use(express.static(argv.wwwroot));
 }
 
-if (config.initApp) {
-    config.initApp(app, express);
-}
-
 app.get('/', function(req, res) {
     res.send(index.replace('__mocha_opts__', JSON.stringify(mocha_opt)));
 });
initing app before app.router to allow middleware like logger to be added earlier in the chain