From 46972e69956281036fc6ef723aabdce5b1d38fa2 Mon Sep 17 00:00:00 2001 From: "Glitch (hello-express)" Date: Fri, 23 Oct 2020 19:23:14 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=9D=F0=9F=90=88=20Checkpoint=20./serve?= =?UTF-8?q?r.js:617503/197?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server.js b/server.js index e2d1181..815b279 100644 --- a/server.js +++ b/server.js @@ -1,8 +1,16 @@ +const path = require('path') + // Require the framework and instantiate it const fastify = require("fastify")({ logger: true }); +// Setup our static files +fastify.register(require('fastify-static'), { + root: path.join(__dirname, 'public'), + prefix: '/public/', // optional: default '/' +}) + // Declare a route fastify.get("/", function(request, reply) { reply.send({ hello: "world" });