-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
50 lines (42 loc) · 972 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
44
45
46
47
48
49
50
"use strict";
const Hapi = require("@hapi/hapi");
const Path = require("path");
const Inert = require("@hapi/inert");
const Vision = require("@hapi/vision");
const HapiSwagger = require("hapi-swagger");
const HauteCouture = require("@hapipal/haute-couture");
const init = async () => {
const server = Hapi.server({
port: process.env.PORT,
host: "0.0.0.0",
});
const swaggerOptions = {
info: {
title: "Unofficial Evolve App",
version: "0.1",
},
};
await server.register([
Inert,
Vision,
{
plugin: HapiSwagger,
options: swaggerOptions,
},
]);
await HauteCouture.compose(server);
server.route({
method: "GET",
path: "/",
handler: (request, h) => {
return h.file("public/index.html");
},
});
await server.start();
console.log("I exist to serve %s", server.info.uri);
};
process.on("unhandledRejection", (err) => {
console.log(err);
process.exit(1);
});
init();