Chapter 4,6: prettier updates and web framework samples

This commit is contained in:
Beth Griggs
2020-05-31 19:31:42 +01:00
parent b43bf2c378
commit 0d8170c265
43 changed files with 4820 additions and 242 deletions
+27
View File
@@ -0,0 +1,27 @@
const Hapi = require("@hapi/hapi");
const path = require("path");
const PORT = process.env.PORT || 3000;
const HOSTNAME = process.env.HOSTNAME || "localhost";
const initialize = async () => {
const server = Hapi.server({
port: PORT,
host: HOSTNAME,
});
await server.register(require("@hapi/inert"));
server.route({
method: "GET",
path: "/",
handler: {
file: path.join(__dirname, "files/file.txt"),
},
});
await server.start();
console.log("Server running on %s", server.info.uri);
};
initialize();