'use strict' require('dotenv').config(); const express = require('express'); const bodyParser = require('body-parser'); const app = express(); var cors = require('cors'); app.use(cors()); app.options('*', cors()); var book_route = require('./routes/bookRoute'); const mongoose = require('mongoose'); app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); app.use('/api', book_route); const options = { useNewUrlParser: true, useCreateIndex: true, autoIndex: true, keepAlive: true, poolSize: 10, bufferMaxEntries: 0, connectTimeoutMS: 10000, socketTimeoutMS: 45000, family: 4, useFindAndModify: false, useUnifiedTopology: true } mongoose.connect(`mongodb://192.99.144.232:27017/grupo12?security=false`, options) .then(() => console.log('> Successfully connected to DB')) .catch(err => console.log(err)); app.listen(5000, () => { console.log('> Service running on port 5000'); }) module.exports = app;