{"size": 923, "ext": "js", "max_stars_repo_path": "src/server.js", "max_stars_repo_name": "DDParkas/API-Simples-NodeJS", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/server.js", "max_issues_repo_name": "DDParkas/API-Simples-NodeJS", "max_issues_repo_issues_event_min_datetime": "2021-09-02T00:12:36.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-02T00:12:36.000Z", "max_forks_repo_path": "src/server.js", "max_forks_repo_name": "DDParkas/APISimplesNodeJS", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 25.6388888889, "max_line_length": 62, "alphanum_fraction": 0.6652221018}
const express       = require("express")
const app           = express()
const routes        = require('./routes')
const mongoose      = require('mongoose')
const bodyParser    = require('body-parser')
const config        = require('../config/config')

const options = { 
    reconnectTries:     Number.MAX_VALUE, 
    reconnectInterval:  500, 
    poolSize:           5, 
    useNewUrlParser:    true, 
    useUnifiedTopology: true
}

mongoose.connect(config.bdString,options)

// DEBUG BANCO
mongoose.connection.on('error', (err)=>{
    console.log('Erro de conexao com o banco de dados: '+ err)
})
mongoose.connection.on('disconnected', ()=>{
    console.log('Aplicacao desconectada')
})
mongoose.connection.on('connected', ()=>{
    console.log('Aplicacao conectada corretamente')
})


app.use(bodyParser.urlencoded({extended: false}))
app.use(bodyParser.json())

app.use(routes);
module.exports = app

app.listen(3333)