@forrestjs/service-fastify-static
v5.2.2
Published
ForrestJS service which adds static content serving to a Fastify server.
Downloads
202
Maintainers
Readme
@forrestjs/service-fastify-static
ForrestJS wrapper to the Fastify Static plugin.
Live Demo
https://codesandbox.io/s/service-fastify-static-6u8mm
Install & Setup
Install the dependency:
npm add @forrestjs/service-fastify-static
Add it to your App:
// index.js
const path = require('path');
const forrestjs = require('@forrestjs/core');
const serviceFastify = require('@forrestjs/service-fastify');
const serviceFastifyStatic = require('@forrestjs/service-fastify-static');
// Run the app:
forrestjs.run({
services: [serviceFastify, serviceFastifyStatic],
settings: {
fastify: {
static: {
root: path.join(__dirname, 'public'),
},
},
},
});
Options
setConfig('fastify.static', {
...options here
});