fastify-generate
Version:
Generate fastify applications fastly
21 lines (16 loc) • 452 B
JavaScript
const fp = require('fastify-plugin')
// the use of fastify-plugin is required to be able
// to export the decorators to the outer scope
module.exports = fp(function (fastify, opts, next) {
fastify.decorate('answer', function () {
return 42
})
next()
})
// If you prefer async/await, use the following
//
// module.exports = fp(async function (fastify, opts) {
// fastify.decorate('example', function () {
// return 42
// })
// })