Skip to content

Commit

Permalink
Add swagger route
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Aug 19, 2022
1 parent a0d178f commit c536e35
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@fastify/rate-limit": "^7.0.0",
"@fastify/sensible": "^5.0.0",
"@fastify/static": "^6.4.0",
"@fastify/swagger": "^7.4.1",
"@nearform/sql": "^1.5.0",
"@siteup/cli": "^2.2.0",
"classnames": "^2.3.1",
Expand Down
23 changes: 23 additions & 0 deletions plugins/swagger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import fp from 'fastify-plugin'

/**
* This plugins adds fastify-swagger
*
* @see https://github.com/fastify/fastify-swagger
*/
export default fp(async function (fastify, opts) {
fastify.register(import('@fastify/swagger'), {
routePrefix: '/documentation',
exposeRoute: false,
openapi: {
info: {
title: 'Test swagger',
description: 'testing the fastify swagger api',
version: '0.1.0'
}
}
})
}, {
name: 'swagger',
dependencies: ['env']
})

0 comments on commit c536e35

Please sign in to comment.