Sorry if it's a duplicate but I can't find the solution to this issue.
In NodeJS, I need to export functions from one file to another. Here is what I tried in order to export (written in typescript):
/*** db.ts ***/
module.exports = {
getDoc: (id:string):any => {
return new Observable((observer:any) => {
//Do something
});
},
addDoc: (document:any):any => {
return new Observable((observer:any) => {
//Do something
});
},
}
And to import:
/*** main.ts ***/
import { getDoc, addDoc } from './db'
I want to keep this structure (being able to call each function - getDoc and addDoc - separately).
What am I doing wrong? The export doesn't seem to work.