-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
56 lines (49 loc) · 1.51 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
'use strict'
require("dotenv-safe").load();
const path = require('path');
const AutoLoad = require('fastify-autoload');
module.exports = function (fastify, opts, next) {
fastify.register(require('fastify-swagger'), {
swagger: {
info: {
title: 'Documentação',
description: 'Teste requisições para nossa api por meio desta documentação que utiliza o framework swagger.',
version: '1.0.0'
}
,externalDocs: {
url: 'http://www.website.com.br/api/integracao',
description: 'Encontre maiores detalhes sobre integração com nossa Api neste link.'
}
,host: 'localhost:3000'
,schemes: ['http']
,consumes: ['application/json']
,produces: ['application/json']
,securityDefinitions: {
apiKey: {
type: 'apiKey',
description: "",
name: 'Authorization',
in: 'header'
}
}
}
,exposeRoute: true
,routePrefix: '/documentation'
});
fastify.register(require('fastify-formbody'));
// This loads all plugins defined in plugins
// those should be support plugins that are reused
// through your application
fastify.register(AutoLoad, {
dir: path.join(__dirname, 'plugins'),
options: Object.assign({}, opts)
});
// This loads all plugins defined in services
// define your routes in one of these
fastify.register(AutoLoad, {
dir: path.join(__dirname, 'services'),
options: Object.assign({}, opts)
});
// Make sure to call next when done
next()
}