-
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- adding the ability to change swagger url (#56)
- update readme - adding an example file - ignore vscode files - export routes not as a fastify plugin
- Loading branch information
Showing
7 changed files
with
136 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,3 +47,5 @@ package-lock.json | |
|
||
static | ||
|
||
# vscode files | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use strict' | ||
|
||
const fastify = require('fastify')() | ||
|
||
fastify.register(require('../index'), { | ||
swagger: { | ||
info: { | ||
title: 'Test swagger', | ||
description: 'testing the fastify swagger api', | ||
version: '0.1.0' | ||
}, | ||
host: 'localhost', | ||
schemes: ['http'], | ||
consumes: ['application/json'], | ||
produces: ['application/json'] | ||
}, | ||
exposeRoute: true, | ||
routePrefix: '/swagger-docs' | ||
}) | ||
|
||
fastify.put('/some-route/:id', { | ||
schema: { | ||
description: 'post some data', | ||
tags: ['user', 'code'], | ||
summary: 'qwerty', | ||
params: { | ||
type: 'object', | ||
properties: { | ||
id: { | ||
type: 'string', | ||
description: 'user id' | ||
} | ||
} | ||
}, | ||
body: { | ||
type: 'object', | ||
properties: { | ||
hello: { type: 'string' }, | ||
obj: { | ||
type: 'object', | ||
properties: { | ||
some: { type: 'string' } | ||
} | ||
} | ||
} | ||
}, | ||
response: { | ||
201: { | ||
description: 'Succesful response', | ||
type: 'object', | ||
properties: { | ||
hello: { type: 'string' } | ||
} | ||
} | ||
} | ||
} | ||
}, (req, reply) => {}) | ||
|
||
fastify.listen(3000, err => { | ||
if (err) throw err | ||
console.log('listening') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters