title: jwt - vscode - postgresql DB connection/login project
body: <p>i did so many things to solve this problem, i didn't.
  so i am asking some questions related to some error</p>
  <p>when i run code server and client side without no error.
  but the screen is blank and console display error :
  [App.js:24] POST http://localhost:5000/authentication/verify 401 (Unauthorized)</p>
  <p><a href="https://github.com/ousecTic/pern-jwt-tutorial" rel="nofollow noreferrer">https://github.com/ousecTic/pern-jwt-tutorial</a> &lt;&lt; the link</p>
  <p>anyway, i just type the code below, but it doens't work.</p>
  <p>app.js (client side)</p>
  <pre><code>import React, { Fragment, useState, useEffect } from &quot;react&quot;;
  
  import &quot;react-toastify/dist/ReactToastify.css&quot;;
  import {
    BrowserRouter as Router,
    Route,
    Switch,
    Redirect
  } from &quot;react-router-dom&quot;;
  
  import { toast } from &quot;react-toastify&quot;;
  
  //components
  
  import Login from &quot;./components/Login&quot;;
  import Register from &quot;./components/Register&quot;;
  import Dashboard from &quot;./components/Dashboard&quot;;
  
  toast.configure();
  
  function App() {
    const checkAuthenticated = async () =&gt; {
      try {
        const res = await fetch(&quot;http://localhost:5000/authentication/verify&quot;, {
          method: &quot;POST&quot;,
          headers: { jwt_token: localStorage.token }
        });
  
        const parseRes = await res.json();
  
        parseRes === true ? setIsAuthenticated(true) : setIsAuthenticated(false);
      } catch (err) {
        console.error(err.message);
      }
    };
  </code></pre>
  <p>server.js (server side)</p>
  <pre><code> const express = require(&quot;express&quot;);
      const app = express();
      const cors = require(&quot;cors&quot;);
      
      //middleware
      
      app.use(cors());
      app.use(express.json());
      
      //routes
      
      app.use(&quot;/authentication&quot;, require(&quot;./routes/jwtAuth&quot;));
      
      app.use(&quot;/dashboard&quot;, require(&quot;./routes/dashboard&quot;));
      
      app.listen(5000, () =&gt; {
        console.log(`Server is starting on port 5000`);
      });
  </code></pre>
  <p>jwtauth (server side)</p>
  <pre><code>router.post(&quot;/verify&quot;, authorize, (req, res) =&gt; {
    try {
      res.json(true);
    } catch (err) {
      console.error(err.message);
      res.status(500).send(&quot;Server error&quot;);
    }
  });
  
  module.exports = router;
  </code></pre>
  <p>and i checked already below some things.</p>
  <ol>
  <li>i just changed react/react-dorm and others package version in package.json
  in the server/client side. cause it has been changed a lot so many errors occured.
  so i make the package the same version.</li>
  <li>And i checked DB connection / but it seems to work.</li>
  </ol>
  <p>and this is my entire code : <a href="https://github.com/Ryandongyou/jwt_project_dongyou" rel="nofollow noreferrer">https://github.com/Ryandongyou/jwt_project_dongyou</a>
  thank you :)</p>