forked from outmoded/hapijs.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
35 lines (28 loc) · 709 Bytes
/
server.js
File metadata and controls
35 lines (28 loc) · 709 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
30
31
32
33
34
35
var Path = require('path');
var Hapi = require('hapi');
var server = new Hapi.Server(3000);
var Watcher = require('./lib/watcher');
server.route({
method: 'GET',
path: '/{any*}',
handler: {
directory: {
path: Path.join(__dirname, 'output'),
index: true,
defaultExtension: 'html'
}
}
});
server.pack.require({ good: null }, function (err) {
if (err) {
throw err;
}
server.start(function () {
server.log('info', 'Static output preview running at: ' + server.info.uri);
Watcher.watch();
});
});
// suppress error when using "make watch"
process.on('SIGINT', function () {
process.exit(0);
});