forked from cozy/cozy-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.coffee
More file actions
24 lines (19 loc) · 780 Bytes
/
server.coffee
File metadata and controls
24 lines (19 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
initialize = require './server/initialize'
application = module.exports = (callback) ->
americano = require 'americano'
options =
name: 'sync'
port: process.env.PORT or 9116
host: process.env.HOST or "127.0.0.1"
root: __dirname
require('./server/models/webdavaccount').first ->
americano.start options, (err, app, server) ->
User = require './server/models/user'
Realtimer = require 'cozy-realtime-adapter'
realtime = Realtimer server : server, ['event.*']
realtime.on 'user.*', -> User.updateUser()
User.updateUser() # initialize User attributes.
initialize ->
callback app, server if callback?
if not module.parent
application()