I have an application made in reactjs , I manage the dependencies with nodejs and I want to connect to a database that I have installed locally.
install express and mongodb using npm.
this error is generated when I lift the application:
Module not found: 'module' in C: \ Projects \ ZarateAlarms \ zaw \ node_modules \ requir @ ./~/require_optional/~/resolve-from/index.js 3: 13-30
and my code is:
var MongoClient = require('mongodb').MongoClient;
MongoClient.connect('mongodb://localhost:27017/animals', function(err, db) {
if (err) {
throw err;
}
db.collection('mammals').find().toArray(function(err, result) {
if (err) {
throw err;
}
console.log(result);
});
});