title: Where is entry point of nextjs application?
body: <p>When deploying nextjs app to <code>c-panel</code> hosting it asks for entry point of the application which default is <code>app.js</code>. In normal react application it's totally in control but when using <code>nextjs</code> it's not clear which js file is resposible to fire-up the application. </p>
  
  <p><a href="https://i.stack.imgur.com/8VaMc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8VaMc.png" alt="enter image description here"></a></p>
  
  <p>any idea on picking right js file as application entry point?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>My hosting provider provided me with following code to setup an express app (which uses next's request handler) to handle the request:</p>
  
  <pre class="lang-js prettyprint-override"><code>const express = require('express');
  const next = require('next');
  
  const dev = process.env.NODE_ENV !== 'production';
  const nextApp = next({ dev });
  const handle = nextApp.getRequestHandler();
  
  const port = 3454;
  
  nextApp.prepare().then(() =&gt; {
    const app = express();
  
    app.get('*', (req, res) =&gt; {
      return handle(req, res);
    });
  
    app.listen(port, err =&gt; {
      if (err) throw err;
      console.log(`&gt; Ready on localhost:${port}`);
    });
  });
  </code></pre>
  
  <p>it works but it's slow because it compiles source files on demand to server requests.</p>