Skip to content

Commit 13afbd6

Browse files
authored
feat: add default and named export (#170)
* refactor: use fastify-plugin * refactor: remove fastify-plugin
1 parent 8c75674 commit 13afbd6

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,5 @@ httpProxy[Symbol.for('plugin-meta')] = {
197197
}
198198

199199
module.exports = httpProxy
200+
module.exports.default = httpProxy
201+
module.exports.fastifyHttpProxy = httpProxy

test/export.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict'
2+
3+
const t = require('tap')
4+
5+
const fastifyHttpProxy = require('..')
6+
const defaultExport = require('..').default
7+
const { fastifyHttpProxy: namedExport } = require('..')
8+
9+
t.test('module export', function (t) {
10+
t.plan(1)
11+
t.equal(typeof fastifyHttpProxy, 'function')
12+
})
13+
14+
t.test('default export', function (t) {
15+
t.plan(1)
16+
t.equal(typeof defaultExport, 'function')
17+
})
18+
19+
t.test('named export', function (t) {
20+
t.plan(1)
21+
t.equal(typeof namedExport, 'function')
22+
})

0 commit comments

Comments
 (0)