Answers for "install mongoose node js"

10

how to install mongoose

$ npm install mongoose
Posted by: Guest on May-18-2020
3

mongoose

const mongoose = require('mongoose');

mongoose.connect('mongodb://localhost:27017/twitter', {
    useNewUrlParser: true,
    useUnifiedTopology: true
});

const db = mongoose.connection;

db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function () {
    console.log("Database Connected !!!");
});

module.exports = db;
Posted by: Guest on October-03-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language