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" });