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