diff --git a/setup/databaseConnection.js b/setup/databaseConnection.js index bda7ab6..b6d412e 100644 --- a/setup/databaseConnection.js +++ b/setup/databaseConnection.js @@ -1,4 +1,5 @@ const mongoose = require('mongoose') +const redisClient = require('./redis') const port = process.env.PORT || 3000 const env = process.env.NODE_ENV || 'development' module.exports = (app) => { @@ -14,13 +15,17 @@ module.exports = (app) => { .connect(connectionString, {}) .then(async function () { console.log('MongoDB Database Connected') - const MyModel = mongoose.model('MyCollection', new mongoose.Schema({name: String})); + const MyModel = mongoose.model('MyCollection', new mongoose.Schema({ name: String })) // Create a document to force MongoDB to actually create the DB and collection - await MyModel.create({name: 'test'}); + await MyModel.create({ name: 'test' }) - app.listen(port, function () { - console.log('Server Started On Port ' + port) + redisClient.connect().then((r) => { + console.log('Redis connection Established') + + app.listen(port, function () { + console.log('Server Started On Port ' + port) + }) }) }) .catch(function (err) {