-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (19 loc) · 743 Bytes
/
Copy pathindex.js
File metadata and controls
26 lines (19 loc) · 743 Bytes
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
// ----------------- Import de dependências ----------------- //
const swaggerUi = require('swagger-ui-express');
const bodyParser = require('body-parser');
const express = require('express');
const swaggerYaml = require('yamljs').load('./swagger.yaml');
// Inicialização e configuração do app
const app = express();
app.use(bodyParser.json({ limit: '5mb' }));
//Definição do Swagger
app.use('/swagger', swaggerUi.serve, swaggerUi.setup(swaggerYaml));
// Not Found Middleware
app.use((request, response, next) => {
return response.status(404).send({ 'message': 'Rota não encontrada.' });
});
//Inicialização do APP
app.listen(3000, () => {
console.log('Servidor inicializado na porta 3000.');
});
module.exports = app;