-
Notifications
You must be signed in to change notification settings - Fork 39
/
walmart.js
45 lines (36 loc) · 885 Bytes
/
walmart.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
'use strict';
const Hapi = require('@hapi/hapi');
const Inert = require('@hapi/inert');
const init = async () => {
// create the [formerly] Walmart Labs Hapi Server
const server = Hapi.server({
port: process.env.PORT || 8000,
host: 'localhost'
});
await server.register(Inert);
// serve up all static content in public folder
server.route({
method: 'GET',
path: '/{path*}',
handler: {
directory: {
path: './public',
listing: false
}
}
});
server.route({
method: 'GET',
path: '/greeting',
handler: (request, h) => {
return 'Hi World!';
}
});
await server.start();
console.log(`=> Mullet Stack running at: ${server.info.uri}`);
};
process.on('unhandledRejection', (err) => {
console.log(err);
process.exit(1);
});
init();