     for module in appFile
       if Array.isArray(module.route)
         for subRoute in module.route
-          buildStaticRoute(subRoute, module, appRoutes)
+          buildStaticRoute(subRoute, module, appRoutes, conf)
       else
-        buildStaticRoute(module.route, module, appRoutes)
-
+        buildStaticRoute(module.route, module, appRoutes, conf)
+    
+    
+    console.log(appRoutes)
+    process.exit(1)
      _console.error("No HTML template file to serve provided to MithrilStatic")
      return
    
    appFile = require(conf.source)()
    appRoutes = {}
    console.log(global.m)
    process.exit(1)
    
    if not Array.isArray(appFile)
      _console.error("Mithril app file #{conf.source} doesn't return an array of modules")

_console = require('./Console.coffee')
fs = require('fs')
utils = require('./Utils.coffee')


buildStaticRoute = (route, module, rootHash, conf) ->
  rootHash[route] = (req, res) ->
    m.toString(module, (html)->
      conf.tokens.compiledHtml = html
      utils.TokenReplacer(conf.htmlTemplate, conf.tokens, (err, data)->
        res.send(err or data)
      )
    , req, res)


module.exports = 
