-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.js
46 lines (38 loc) · 1.03 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* NOTE: This file is simply for testing this connector and will not
* be used or packaged with the actual connector when published.
*/
var Arrow = require('arrow'),
server = new Arrow()
// lifecycle examples
server.on('starting', function () {
server.logger.debug('server is starting!')
})
server.on('started', function () {
server.logger.debug('server started!')
})
// a simple user model
var model = Arrow.createModel('testmodel', {
fields: {
title: { type: String }
},
connector: 'appc.jwplayer',
metadata: {
endpoint: 'channels/videos',
key: 'videos' // only for nested API calls to JWplayer
}
})
// add the model since we're creating outside of models directory
server.addModel(model)
// {"channel_key": "8BdtZjpN"}
// model.findAll(function(err, coll) {
// console.log(arguments);
// });
model.query({ channel_key: 'R3yEYct7' }, function (err, coll) {
console.log(arguments)
})
// model.findOne('R3yEYct7', function(err, coll) {
// console.log(arguments);
// });
// start the server
server.start()