diff src/app.coffee @ 0:b73191efc65b

Initial import of pumpbridge (bloody bloody alpha)
author Mathias Gebbe <mgebbe@intevation.de>
date Thu, 05 Jun 2014 10:35:15 +0200
parents
children 98a070c98982
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/app.coffee	Thu Jun 05 10:35:15 2014 +0200
@@ -0,0 +1,47 @@
+# Copyright (C) 2014 by Intevation GmbH
+# Author: Mathias Gebbe <mgebbe@intevation.de>
+#
+# This file is Free Software under the Apache License, Version 2.0
+# (the "License"); and comes with ABSOLUTELY NO WARRANTY!
+# You may not use this file except in compliance with the License.
+# See LICENSE for details.
+
+async = require 'async'
+databank = require 'databank'
+Databank = databank.Databank
+DatabankObject = databank.DatabankObject
+PumpIOClientApp = require 'pump.io-client-app'
+Sync = require('./sync')
+Config = require('./config')
+routes = require('./routes')
+config = Config.config
+
+async.waterfall [
+  (callback) ->
+    # sets up the config
+    app = new PumpIOClientApp(config)
+
+    # Attach shadows to the user
+
+    routes.addRoutes app
+
+    # Start the app
+    app.log.debug
+      port: config.port
+      address: config.address
+    , 'Starting app listener'
+
+    app.run (err) ->
+      if err
+        app.log.error err
+      else
+        console.log 'Express server is listening
+        on address %s port %d', config.address, config.port
+
+        # Start Deamon!
+        Sync.sync()
+
+        #app.get '/hello', (req, res) ->
+        # res.send 'Hello, Zaiste!'
+      return
+], (err, result) ->
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)