I have two separate files and I want to use functions and variables in my first file in another file. What I mean is, here is the content of my first file:
const db = mongoose.connection;
and in my second file I need to for example log it:
console.log(db)
I used export and import but it did not work:
export const db = mongoose.connection;
import db from (./db.js)
console.log(db)
I got this error: SyntaxError: Cannot use import statement outside a module