-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (25 loc) · 748 Bytes
/
index.js
File metadata and controls
29 lines (25 loc) · 748 Bytes
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
var Hapi = require('hapi');
var sources = require("./sources/");
var server = new Hapi.Server();
server.connection({ port: 3000, labels: ['api'] });
sources.populate(server);
server.ext("onPreResponse", function(request, reply) {
request.response.header("Strict-Transport-Security",
"max-age=63072000; includeSubdomains; preload");
return reply.continue();
});
server.register({
register: require('hapi-swagger'),
options: {
apiVersion: "1.0"
}
}, function (err) {
if (err) {
server.log(['error'], 'hapi-swagger load error: ' + err)
}else{
server.log(['start'], 'hapi-swagger interface loaded')
}
});
server.start(function () {
console.log('Server running at:', server.info.uri);
});