-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
38 lines (31 loc) · 953 Bytes
/
server.js
File metadata and controls
38 lines (31 loc) · 953 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
27
28
29
30
31
32
33
34
35
36
37
38
const express = require('express');
const requireDir = require('require-dir');
const swaggerUI = require('swagger-ui-express');
const swaggerJsDoc = require('swagger-jsdoc');
const PORT = process.env.PORT || 4000;
const options = {
definition :{
openapi: "3.0.0",
info :{
title: "API consultaCep e Cotação Dolar",
version: "1.0",
description: "API de consulta a CEP e a cotação diaria do Dolar"
},
servers:[
{
url: "http://localhost:3000"
}
],
},
apis: ["./src/controllers/*.js"],
};
const specs = swaggerJsDoc(options);
//iniciando o app
const app = express();
app.use('/doc', swaggerUI.serve, swaggerUI.setup(specs));
//aceite dados como json..
app.use(express.json());
//app.user é: interceptador de requisições
//app.use('/api', require('./src/routes'));
app.use( require('./src/routes'));
app.listen(3000);