title: angular 2 file works directly directly but not via nodejs express file
body: <p>I am starting a MEA2N app, and built a small express server running on port 3000.
  The angular app runs on port 4200. If I open localhost 3000 I see 'loading...' ergo the app does not run. While if I open localhost 4000 I get 'app working'. Does anybody know how this might happen?</p>
  
  <p>server.js is very standard: </p>
  
  <pre><code>// Get dependencies
  const express = require('express');
  const path = require('path');
  const http = require('http');
  const bodyParser = require('body-parser');
  
  // Get our API routes
  const api = require('./server/routes/api');
  
  const app = express();
  
  // Parsers for POST data
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: false }));
  
  // Point static path to dist
  app.use(express.static(path.join(__dirname, 'dist')));
  
  // Set our api routes
  app.use('/api', api);
  
  // Catch all other routes and return the index file
  app.get('*', (req, res) =&gt; {
    res.sendFile(path.join(__dirname, './src/index.html'));
  });
  
  /**
   * Get port from environment and store in Express.
   */
  const port = process.env.PORT || '3000';
  app.set('port', port);
  
  /**
   * Create HTTP server.
   */
  const server = http.createServer(app);
  
  /**
   * Listen on provided port, on all network interfaces.
   */
  server.listen(port, () =&gt; console.log(`API running on localhost:${port}`));
  </code></pre>
  
  <p>server.js is running in root folder.
  angular app is root/src/indxex.html and root/src/app/</p>