title: nodejs how to execute other js file from index.js?
body: <p>I want to create web app with nodejs but with structure like this</p>
  
  <pre><code>- modules
    | - module1
        | - module1.js
    | - module2
        | - module2.js
  - index.js
  - settings.js
  </code></pre>
  
  <ul>
  <li>First, i never use nodejs from scratch</li>
  <li>Second, i know you will suggest using any other framework, sorry guys here i want to understand how nodejs and may be other nodejs framework works.</li>
  <li>Third, this is for educational purpose</li>
  </ul>
  
  <hr>
  
  <p>in <code>modules/module1/module1.js</code> :</p>
  
  <pre><code>res.setHeader('Content-Type', 'text/plain; charset=utf-8')
  res.end('Hello World aw!')
  </code></pre>
  
  <p>honestly i dont know how to code it properly, what i really want is i wanna execute that code and response to browser <code>Hello World aw!</code> from index.js :</p>
  
  <pre><code>router.get('/', function (req, res) {
    //in here i call modules/module1/module1.js, and execute the code
  })
  </code></pre>
  
  <p>and how to do that properly? so it can run well</p>