-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
57 lines (46 loc) · 1.29 KB
/
server.js
File metadata and controls
57 lines (46 loc) · 1.29 KB
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
var Hapi = require('hapi'),
fs = require('fs'),
Bell = require('./bell'),
Cookie = require('hapi-auth-cookie'),
Config = require('./tokens'),
good = require('good'),
options = require('./log-options'),
Handlebars = require('handlebars'),
Path = require('path'),
server = new Hapi.Server();
server.connection({
port: process.env.PORT || 8000,
});
server.views({
engines : {
html : Handlebars,
},
helpersPath: 'helpers',
path : Path.join(__dirname, 'public'),
});
server.register([Bell, Cookie], function (err) {
if (err) throw err;
server.auth.strategy('session', 'cookie', {
cookie: 'sid',
password: Config.session.cookieOptions.password,
redirectTo: 'false',
isSecure:false,
});
server.auth.strategy('google', 'bell', {
provider: 'google',
password: Config.auth.google.password,
clientId: Config.auth.google.clientId,
clientSecret: Config.auth.google.clientSecret,
isSecure: false
});
});
server.route(require('./routes'));
module.exports = server;
server.register({ register: good, options: options }, function (err) {
if (err) {
throw err;
}
server.start(function () {
server.log('info', 'Server running at: ' + server.info.uri);
});
});