Chapter 11: update example microservice
This commit is contained in:
@@ -11,6 +11,6 @@ that will then be used in the rest of your application.
|
||||
|
||||
Check out:
|
||||
|
||||
* [The hitchhiker's guide to plugins](https://github.com/fastify/fastify/blob/master/docs/Plugins-Guide.md)
|
||||
* [The hitchhiker's guide to plugins](https://www.fastify.io/docs/latest/Plugins-Guide/)
|
||||
* [Fastify decorators](https://www.fastify.io/docs/latest/Decorators/).
|
||||
* [Fastify lifecycle](https://www.fastify.io/docs/latest/Lifecycle/).
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
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(async function (fastify, opts) {
|
||||
fastify.decorate('someSupport', function () {
|
||||
return 'hugs'
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user