     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 = require('./Console.coffee')
fs = require('fs')


#buildStaticRoute = (route, module) ->
#  Router.get(route, (req, res)->
#    fs.readFile("#{__dirname}/../../public/index.html", "utf8", (error, data)->
#      m.toString(module, (html)->
#        res.send(
#          utils.tokenReplacement({
#            content: html
#            keywords: 'foo ,bar'
#            description: 'app'
#          },data)
#        )
#      , req, res)
#    )
#  )


module.exports = 

      _console.error("No HTML template file to serve provided to MithrilStatic")
      return
    
    conf.tokens = {} if typeof conf.tokens isnt 'object'
    
    appFile = require(conf.source)()
    appRoutes = {}
    
    if global.m is undefined
      require('./mithril.app.coffee')
    
    if not Array.isArray(appFile)
      _console.error("Mithril app file #{conf.source} doesn't return an array of modules")
