Mercurial > pumpbridge
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:b73191efc65b |
---|---|
1 # Copyright (C) 2014 by Intevation GmbH | |
2 # Author: Mathias Gebbe <mgebbe@intevation.de> | |
3 # | |
4 # This file is Free Software under the Apache License, Version 2.0 | |
5 # (the "License"); and comes with ABSOLUTELY NO WARRANTY! | |
6 # You may not use this file except in compliance with the License. | |
7 # See LICENSE for details. | |
8 | |
9 async = require 'async' | |
10 databank = require 'databank' | |
11 Databank = databank.Databank | |
12 DatabankObject = databank.DatabankObject | |
13 PumpIOClientApp = require 'pump.io-client-app' | |
14 Sync = require('./sync') | |
15 Config = require('./config') | |
16 routes = require('./routes') | |
17 config = Config.config | |
18 | |
19 async.waterfall [ | |
20 (callback) -> | |
21 # sets up the config | |
22 app = new PumpIOClientApp(config) | |
23 | |
24 # Attach shadows to the user | |
25 | |
26 routes.addRoutes app | |
27 | |
28 # Start the app | |
29 app.log.debug | |
30 port: config.port | |
31 address: config.address | |
32 , 'Starting app listener' | |
33 | |
34 app.run (err) -> | |
35 if err | |
36 app.log.error err | |
37 else | |
38 console.log 'Express server is listening | |
39 on address %s port %d', config.address, config.port | |
40 | |
41 # Start Deamon! | |
42 Sync.sync() | |
43 | |
44 #app.get '/hello', (req, res) -> | |
45 # res.send 'Hello, Zaiste!' | |
46 return | |
47 ], (err, result) -> |