title: How do I add multiple pages in Node JS+Express
body: <p>I have followed this tutorial on Node JS for RPI (<a href="https://www.youtube.com/watch?v=QdHvS0D1zAI" rel="nofollow noreferrer">https://www.youtube.com/watch?v=QdHvS0D1zAI</a>) and was wondering how I could add multiple websites to my web app. Whenever I change my page on localhost (localhost:5000/page2) it works just fine, and when I start Nginx and make the app public, the root page works but when I change my page (myip/page2), I get an error 404</p>
  <pre><code>const { readFileSync, writeFileSync } = require(`fs`);
  
  const express = require(`express`);
  const app = express();
  const path = require('path');
  
  
  
  
  app.get(`/`, (req, res) =&gt; {
      const count = readFileSync(`/home/pi/Desktop/database.txt`, `utf-8`);
      console.log(`count`, count)
  
      const newCount = parseInt(count) + 1
      //const newCountString = String.format(newCount)
      
  
      writeFileSync(`/home/pi/Desktop/database.txt`, newCount.toString());
  
      res.send(`
      &lt;!DOCTYPE ,html&gt;
      &lt;html lang=&quot;en&quot;&gt;
      &lt;head&gt;
          &lt;meta charset=&quot;utf-8&quot;/&gt;
          &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale1&quot; /&gt;
          &lt;title&gt;Test Website&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;Test Website&lt;/h1&gt;
          &lt;h1&gt;Index&lt;/h1&gt;
          &lt;p&gt;This page has been loaded ${newCount} times&lt;/p&gt;
          &lt;h1&gt;Page 2:&lt;/h1&gt;
          &lt;a href=&quot;/page2&quot;&gt;Link to Page 2&lt;/a&gt;
          
      &lt;/body&gt;
      &lt;/html&gt;
      `);
  });
  app.get(`/page2`, (req, res) =&gt; {
      //res.sendFile(path.join(__dirname, '/resources/page2.html'));
      res.send(&quot;hello page 2&quot;)
  });
  app.listen(5000, () =&gt; console.log('http://localhost:5000/'));
  </code></pre>
  <p>I am very new to all this and understand it has something to do with routing, but I would like to have an answer that works with what I have here.
  Thanks.
  EDIT: I looked into my Nginx config and I have this:</p>
  <pre><code>server {
      listen 80;
      listen [::]:80;
  
      server_name _;
  
      root /var/www/html;
      #index index.html;
  
      location / {
          proxy_pass http://localhost:5000;
          try_files $uri $uri/ =404;
      }
  }
  </code></pre>
  <p>What would I need to change?</p>