Chapter 6: code samples

This commit is contained in:
Beth Griggs
2020-05-30 19:33:25 +01:00
parent 4f825bdac3
commit b43bf2c378
398 changed files with 6049 additions and 53643 deletions
+24
View File
@@ -0,0 +1,24 @@
const Hapi = require("@hapi/hapi");
const PORT = process.env.PORT || 3000;
const HOSTNAME = process.env.HOSTNAME || "localhost";
const initialize = async () => {
const server = Hapi.server({
port: PORT,
host: HOSTNAME,
});
server.route({
method: "GET",
path: "/",
handler: (request, h) => {
return "Welcome to Hapi.js";
},
});
await server.start();
console.log("Server running on %s", server.info.uri);
};
initialize();