please give me advice about any tutorials or any source to learn i am doing this in index.jsx file
import mongoose from 'mongoose';
let dbConn = mongoose.connect('mongodb://localhost/Accomodation');
if (dbConn) {
console.log('suceess');
}else {
console.log('fail');}
and webpack.config.js file
module: {
rules: [
{
test: /\.jsx?$/,
use: 'babel-loader'
// exclude: /node_modules/
},
],
loaders: [
{ test: /\.css$/, loader: "style-loader!css-loader", include: /public/ },
// ...
]
},
i alredy install mongoose ...so why is it not connect?
I got this error
ERROR in ./node_modules/mongodb/lib/url_parser.js
Module not found: Error: Can't resolve 'dns' in 'J:\React\accomodation\node_modules\mongodb\lib'
@ ./node_modules/mongodb/lib/url_parser.js 7:12-26
@ ./node_modules/mongodb/lib/mongo_client.js
@ ./node_modules/mongodb/index.js