1 | // Name : Example Backbone Server
|
2 | // Author : Nate Hunzaker
|
3 | // License : MIT
|
4 |
|
5 | require('../lib/backbone-server');
|
6 |
|
7 | //-- 1. Create Backbone.Server
|
8 | App = new Backbone.Server({
|
9 | 'port' : 9000,
|
10 | 'socketio' : true,
|
11 |
|
12 | // Database Config
|
13 | 'database' : {
|
14 | 'adapter' : 'mongo',
|
15 | 'location' : 'mongodb://localhost/example_db'
|
16 | }
|
17 | });
|
18 |
|
19 | //-- 2. Require Modules
|
20 | App.load('app/routes');
|
21 | App.load('app/models');
|
22 |
|
23 |
|
24 | //-- 3. Collections
|
25 | articles = new Articles().fetch();
|
26 |
|
27 |
|
28 | //-- 4. Socket.IO Events
|
29 |
|
30 | App.bind('connection', function() {
|
31 |
|
32 | App.send('updateDB', articles.toJSON());
|
33 |
|
34 | });
|
35 |
|
36 |
|
37 | //-- 6. Start Server
|
38 | App.start(); |
\ | No newline at end of file |