-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (34 loc) · 821 Bytes
/
index.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
'use strict';
const os = require('os');
os.hostname = () => 'localhost';
const Hapi = require('@hapi/hapi');
const Path = require('path');
const server = Hapi.server({
port: process.env.PORT || 3000,
routes: {
files: {
relativeTo: Path.join(__dirname, 'public')
}
}
});
const init = async () => {
server.route({
method: 'GET',
path: '/',
handler: (request, h) => {
return h.response('Hello home!');
}
});
server.route({
method: 'GET',
path: '/test',
handler: (request, h) => {
return h.response('Hello test!');
}
});
await server.start();
console.log(`Server running at: ${server.info.uri}`);
//module.exports = server;
};
init();
module.exports = server;