title: How to handle fetch API request with express js
body: <p>I want to send request using <strong>fetch API</strong> and want to handle those request with <strong>Express JS</strong>.</p>
  <p>I have created <strong>server.js</strong> (express JS), <strong>index.html</strong> (home page) and <strong>signin.html</strong> (signin page).</p>
  <p><strong>index.html</strong></p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Home Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt; &lt;center&gt;Welcome&lt;/center&gt; &lt;/h1&gt;
      &lt;center&gt; &lt;button onclick=&quot;login()&quot;&gt;Signin&lt;/button&gt; &lt;/center&gt;
  &lt;/body&gt;
  
  &lt;script&gt;
      function login() 
      {   
          fetch('./signin.html')
          .then(res =&gt; console.log(res))
          .catch(err =&gt; console.log(err));        
      }   
  &lt;/script&gt;
  
  &lt;/html&gt;
  </code></pre>
  <p><strong>server.js</strong></p>
  <pre><code>const path = require('path');
  const express = require('express');
  const app = express();
  
  app.get('/', (req,res) =&gt;{
      res.sendFile(path.join(__dirname,'index.html'));
  }); 
  
  app.get('/signin.html', (req,res) =&gt;{
      res.sendFile(path.join(__dirname,'signin.html'));
  }); 
  
  app.listen(8080);
  </code></pre>
  <p>I want when user <strong>click the Sign in button, <code>fetch api</code> send a request to <strong><code>server.js</code></strong> file and <strong><code>server.js</code></strong> send back response to <code>fetch api</code> and render the response to the browser</strong>.</p>
  <p>Is it possible?</p>