-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
58 lines (54 loc) · 1.4 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
var hapi = require('hapi');
var server = hapi.createServer(5000, 'localhost');
var moonboots = require('moonboots_hapi');
var config = require('getconfig');
var templatizer = require('templatizer');
var stylizer = require('stylizer');
var peopleAPI = require('./plugins/peopleAPI');
server.route({
method: 'GET',
path: '/api/me',
handler: function (request, reply) {
reply({
id: '0',
givenName: 'Ryan',
familyName: 'Pylipow',
email: 'rpylipow@gmail.com'
});
}
});
server.pack.register([
peopleAPI,
{
plugin: moonboots,
options: {
appPath: '/{p*}',
moonboots: {
main: __dirname + '/client/app.js',
developmentMode: config.isDev,
stylesheets: [
__dirname + '/public/bootstrap.css',
__dirname + '/public/app.css'
],
beforeBuildJS: function () {
if (config.isDev) {
templatizer(__dirname + '/templates', __dirname + '/client/templates.js')
}
},
beforeBuildCSS: function (done) {
if (!config.isDev) return done();
stylizer({
infile: __dirname + '/public/app/main.styl',
outfile: __dirname + '/public/app.css',
development: true,
watch: __dirname + '/public/app/**/*.styl'
}, done);
}
}
}
}
],
function () {
server.start();
console.log("App running on 5000.");
});