An example of simple API Gateway with NodeJS and ExpressJs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

17 lines
528 B

const mongoose = require('mongoose')
const { DB_NAME } = require('./configs/config')
mongoose.set('runValidators', true)
module.exports = {
openDatabaseConnection: () => {
console.log('Connecting to database')
mongoose.connect(`mongodb://localhost:27017/${DB_NAME}`, { useNewUrlParser: true, useUnifiedTopology: true })
.then(result => {
console.log('Connected to database')
})
.catch(err => {
console.log(err)
throw Error(err)
})
}
}