UNPKG
@fastify/autoload
Version:
latest (6.4.0)
next (6.0.0)
6.4.0
6.3.1
6.3.0
6.2.0
6.1.0
6.0.3
6.0.2
6.0.1
6.0.0
6.0.0-pre.fv5.1
5.10.0
5.9.0
5.8.3
5.8.2
5.8.1
5.8.0
5.7.2
5.7.1
5.7.0
5.6.0
5.5.0
5.4.1
5.4.0
5.3.1
5.3.0
5.2.0
5.1.0
5.0.0
4.0.1
4.0.0
Require all plugins in a directory
github.com/fastify/fastify-autoload
fastify/fastify-autoload
@fastify/autoload
/
test
/
commonjs
/
options
/
plugins
/
plugin-b.js
16 lines
(10 loc)
•
267 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict'
const
fp =
require
(
'fastify-plugin'
)
function
plugin
(
f, opts, next
) { f.
get
(
'/plugin-b'
,
(
request, reply
) =>
{ reply.
send
({
data
: opts.
b
}) })
next
() } plugin.
autoConfig
= {
b
:
'test-2'
}
module
.
exports
=
fp
(plugin, {
name
:
'plugin-b'
})