-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
55 lines (44 loc) · 1.4 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict';
var path = require('path');
var http = require('http');
var messageSocket = require('./message-socket');
var internals = {};
internals.getOptions = function(pathStr) {
var options = {
host: 'localhost',
path: '/api/'+pathStr,
port: '3000',
headers: {'Authorization' : 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvYmoiOiI1M2RmZWUwYTdkNzQxYzZjMDZmYzcwYTYiLCJleHAiOjE0MDg4MDczOTguNzE4LCJpYXQiOjE0MDg3MjA5OTh9.dYKwH1kY9uWmYKi3_fnjMs4wWELsBpAV_PgIU8lZ0Hk'}
}
return options;
}
module.exports = {
config: function(extension, opts, next) {
extension.logInfo('Starting Holly\'s Plugin!');
extension.api({
method: 'GET',
path: '/holly/{name}',
config: {
handler: function (req, reply) {
reply('Options: '+req.params.name);
},
auth:false,
plugins: {hal:{api:'hp:holly'}}
}
});
extension.api({
method: 'GET',
path: '/holly',
config: {
handler: function (req, reply) {
reply('This is the main page.');
},
auth:false,
plugins: {hal:{api:'hp:hollyMain'}}
}
});
extension.namespace({name:'hollyplugin', prefix:'hp', dir:path.join(__dirname, 'rels')});
messageSocket(extension);
next();
}
};