     grunt.log.writeln("Starting express web server in \"./generated\" on port #{webPort}")
     grunt.log.writeln("Simulating HTML5 pushState: Serving up '#{webRoot}/index.html' for all other unmatched paths") if pushStateEnabled
 
-    app.listen webPort, ->
+    server.listen webPort, ->
       resetRoutesOnServerConfigChange(app)
 
   pushStateSimulator = (cwd, webRoot) ->

###
module.exports = (grunt) ->
  _ = grunt.util._
  express = require("express")
  httpProxy = require("http-proxy")
  fileUtils = require("./../lib/file-utils")

    pushStateEnabled = grunt.config.get("server.pushState")
    @requiresConfig("server.apiProxy.prefix") if pushStateEnabled and apiProxyEnabled
    app = express()
    server = http.createServer(app)

    userConfig.modifyHttpServer(server) if userConfig.modifyHttpServer
            
    app.configure ->
      app.use(express.compress())
      app.use(express.static("#{process.cwd()}/#{webRoot}"))
