mgebbe@0: # Copyright (C) 2014 by Intevation GmbH mgebbe@0: # Author: Mathias Gebbe mgebbe@0: # mgebbe@3: # This file is Free Software under the Apache License, Version 2.0; mgebbe@3: # and comes with NO WARRANTY! mgebbe@3: # See the documentation coming with pumpbridge for details. mgebbe@0: mgebbe@0: async = require 'async' mgebbe@0: databank = require 'databank' mgebbe@0: Databank = databank.Databank mgebbe@0: DatabankObject = databank.DatabankObject mgebbe@0: PumpIOClientApp = require 'pump.io-client-app' mgebbe@0: Sync = require('./sync') mgebbe@0: Config = require('./config') mgebbe@0: routes = require('./routes') mgebbe@0: config = Config.config mgebbe@0: mgebbe@0: async.waterfall [ mgebbe@0: (callback) -> mgebbe@0: # sets up the config mgebbe@0: app = new PumpIOClientApp(config) mgebbe@0: mgebbe@0: routes.addRoutes app mgebbe@0: mgebbe@0: # Start the app mgebbe@0: app.log.debug mgebbe@0: port: config.port mgebbe@0: address: config.address mgebbe@0: , 'Starting app listener' mgebbe@0: mgebbe@0: app.run (err) -> mgebbe@0: if err mgebbe@0: app.log.error err mgebbe@0: else mgebbe@0: console.log 'Express server is listening mgebbe@0: on address %s port %d', config.address, config.port mgebbe@0: mgebbe@0: # Start Deamon! mgebbe@0: Sync.sync() mgebbe@0: mgebbe@0: #app.get '/hello', (req, res) -> mgebbe@0: # res.send 'Hello, Zaiste!' mgebbe@0: return mgebbe@0: ], (err, result) ->