I come across two different ways of importing modules in Node.js. When do we need to use curly braces to import the modules?
var mongoose = require('mongoose');
var {mongoose} = require('./db/mongoose.js');
In ES6, we can import the named exports using curly braces as follows:
import {mongoose} from './db/mongoose.js'
Is the same rule applicable for importing using require
as well?