I have a directory structure which looks somewhat like this (both folders have node_modules available)
- task1
- src
- shorten.js
- task2
- src
- api.js
- server.js
In shorten.js
I have two functions namely shorten(url)
and checkLink(url)
. At the end of the file, I have something as module.exports = shorten
.
In the api.js
, I have a line const shorten = require("../../task1/src/shorten");
. If I simply call shorten
with the parameter, it is having no problems, but the problem comes when I try to call checkLink
in a similar way.
What should I do in order to be able to call checkLink
inside api.js of task2?