This repository has been archived by the owner on Jan 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
71 lines (63 loc) · 1.91 KB
/
server.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
var hapi = require('hapi');
var moonboots = require('moonboots_hapi');
var config = require('getconfig');
var templatizer = require('templatizer');
var stylizer = require('stylizer');
var models = require('./models');
var dulcimer = require('dulcimer');
var platform_gateway_auth = require('platform-gateway-auth');
dulcimer.connect(config.dulcimer);
var server = hapi.createServer(config.api.http.port, config.api.http.host);
server.pack.register({
plugin: platform_gateway_auth,
options: {},
}, function () {
console.log("gateway auth registered");
});
server.route({
method: 'GET',
path: '/task',
handler: function (request, reply) {
reply(200, {hi: 1});
console.log(request.auth);
},
config: {
auth: 'gateway',
}
});
server.route({
method: 'GET',
path: '/task/{id}',
handler: function (request, reply) {
}
});
server.pack.register({
plugin: moonboots,
options: {
appPath: '/{p*}',
moonboots: {
main: __dirname + '/client/app.js',
developmentMode: config.devMode,
beforeBuildJS: function () {
templatizer(__dirname + '/templates', __dirname + '/client/templates.js');
},
beforeBuildCSS: function (callback) {
stylizer({
infile: __dirname + '/assets/styles/main.styl',
outfile: __dirname + '/assets/main.css',
development: config.isDev,
watch: __dirname + '/assets/**/*.styl'
}, function () {
callback();
});
},
stylesheets: [
//__dirname + '/assets/bootstrap.css',
__dirname + '/assets/main.css'
]
}
}
}, function () {
console.log('running server at http://' + config.api.http.host + ':' + config.api.http.port);
server.start();
});