Commit 7a2b3320ec67de0d505361cc84a805eb57738859
1 parent
053686f0
Exists in
master
and in
1 other branch
lida com endpoint invalido
Showing
3 changed files
with
13 additions
and
6 deletions
Show diff stats
logsystem/errors.log
| 1 | 1 | { |
| 2 | 2 | "resumo": { |
| 3 | 3 | "bloqueante": { |
| 4 | - "1": 1, | |
| 4 | + "1": 2, | |
| 5 | 5 | "2": 0, |
| 6 | 6 | "3": 0, |
| 7 | - "4": 0 | |
| 7 | + "4": 1 | |
| 8 | 8 | }, |
| 9 | 9 | "nao-bloqueante": { |
| 10 | 10 | "1": 0, |
| ... | ... | @@ -17,6 +17,6 @@ |
| 17 | 17 | "1": "detalhe do erro", |
| 18 | 18 | "2": "detalhe", |
| 19 | 19 | "3": "detalhe", |
| 20 | - "4": "detalhe" | |
| 20 | + "4": "Rota nao encontrada" | |
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | \ No newline at end of file | ... | ... |
logsystem/services.log
server.js
| ... | ... | @@ -100,8 +100,9 @@ app.post('/glosa', function(req, res) { |
| 100 | 100 | }); |
| 101 | 101 | }); |
| 102 | 102 | |
| 103 | +// para testes apenas | |
| 103 | 104 | app.get('/incrementaerro', function(req, res) { |
| 104 | - logger.incrementError("1", "detalhe do erro"); | |
| 105 | + // logger.incrementError("1", "detalhe do erro"); | |
| 105 | 106 | // logger.incrementService("videos", "traducoes"); |
| 106 | 107 | res.send(200, "Incrementado"); |
| 107 | 108 | }); |
| ... | ... | @@ -160,6 +161,12 @@ app.get('/limparfila', function(req, res) { |
| 160 | 161 | res.send(200, "Fila limpa"); |
| 161 | 162 | }); |
| 162 | 163 | |
| 164 | +// precisa ficar no final caso o request n bata com nenhuma rota anterior | |
| 165 | +app.get('/*', function(req, res){ | |
| 166 | + logger.incrementError("4", "Rota nao encontrada"); | |
| 167 | + res.send(404, { 'status': 'Rota nao encontrada' } ); | |
| 168 | +}); | |
| 169 | + | |
| 163 | 170 | app.listen(properties.port, properties.host, function(){ |
| 164 | 171 | console.log('Server running on ' + properties.host + ':' + properties.port); |
| 165 | 172 | }); | ... | ... |