lekshmi
lekshmi

Reputation: 101

Cannot find module './config' mean stack

While trying to connect mongodb with Swagger, it is always showing

Error: Cannot find module './config'

var mongoose = require('mongoose'),
sw = require('swagger-node-express'),
config = require('./config'),
db = mongoose.connection;

db.on('error', function() {
console.log('Database connection error'.red);
});
db.on('connecting', function () {
console.log('Database connecting'.cyan);
});


mongoose.connect(config.db_url, {server: {auto_reconnect: true}});

Upvotes: 0

Views: 1341

Answers (1)

linux
linux

Reputation: 151

Your config file is not in the root directory It needs to be in the same level with your app.js file

Upvotes: 1

Related Questions