-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
38 lines (33 loc) · 1.74 KB
/
index.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
module.exports = function(sails){
var connect = require('./lib/snips.connect.js');
var notify = require('./lib/snips.notify.js');
var inject = require('./lib/snips.inject.js');
var setup = require('./lib/snips.setup.js');
var exec = require('./lib/snips.exec.js');
var SnipsController = require('./controller/SnipsController.js');
gladys.on('ready', function(){
connect();
});
return {
inject: inject,
notify: notify,
setup: setup,
exec: exec,
routes: {
before: {
'get /snips/satellites': (req, res, next) => sails.hooks.policies.middleware.checktoken(req, res, next),
'get /snips/known/slots': (req, res, next) => sails.hooks.policies.middleware.checktoken(req, res, next),
'put /snips/inject': (req, res, next) => sails.hooks.policies.middleware.checktoken(req, res, next),
'put /snips/slot/:slot/add/value': (req, res, next) => sails.hooks.policies.middleware.checktoken(req, res, next),
'delete /snips/slot/:slot/delete/value': (req, res, next) => sails.hooks.policies.middleware.checktoken(req, res, next)
},
after: {
'get /snips/satellites': SnipsController.getSatellites,
'get /snips/known/slots': SnipsController.getCachedSlots,
'put /snips/inject': SnipsController.inject,
'put /snips/slot/:slot/add/value': SnipsController.addSlotValue,
'delete /snips/slot/:slot/delete/value': SnipsController.deleteSlotValue
}
}
};
};