title: client - server architecture structure (with node js) - where to put the index.html file?
body: <p>I have built a server client app (nodejs - on the server, angular - on the client).</p>
  
  <p>I used to have all my code in one project (one folder) but then I figured it makes more sense for me to divide it, by logic, to a server folder and to a client folder.</p>
  
  <p>I aspire for disconnecting all of the dependencies between the server code and the client code, in the sense that each side can stand alone by its own.</p>
  
  <p><strong>Questions:</strong> </p>
  
  <ol>
  <li>where do I put the index.html? </li>
  </ol>
  
  <p>it is obviously related to the client side but the server (expressJS) is loading it when the server.</p>
  
  <ol start="2">
  <li>lets says I put this index.html file in the client folder like in the picture below..</li>
  </ol>
  
  <p>how can I make the server.js be aware of it?</p>
  
  <p>this code doesn't work:</p>
  
  <pre><code>var app = express();
  app.use(bodyParser.json());
  app.use('/',express.static(__dirname));
  
  app.use('/scripts', express.static(path.join(__dirname,
      'node_modules')));
  
  app.get('/', function (req, res) {
      res.sendFile(express.static(path.join(__dirname + '../client/index.html')));
  });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Qkd79.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qkd79.png" alt="enter image description here"></a></p>