After deployment to netlify, jsonwebtoken is not generated, but as at localhost the token is getting generated

At local environment the token is generated at the browser but after deploying my react app to netlify, token is not generated. No action happened after login. I am setting the jsonwebtoken as after successful verification of the user after the user logged in.

//Loginroute
const express = require("express");
const mongoose = require("mongoose");
const User = require("../models/User");
const bcrypt = require("bcryptjs");
const jwt = require("jsonwebtoken");
const cookieParser = require("cookie-parser");

const secret = "kjsehfuwehr7ewe2iwllqla9wklsmlajsi";

const router = express.Router();
router.use(express.json());
router.use(cookieParser());

router.post('/Login', async (req,res) => {
    const {username, password} = req.body;
    const userDoc = await User.findOne({username});
    const passwordOK = bcrypt.compareSync(password, userDoc.password);
    if(passwordOK) {
        // User logged in
        jwt.sign({username, id:userDoc._id}, secret, {}, (err,token) => {
            if(err) throw err;
            res.cookie('token', token).json({
                id: userDoc._id,
                username
            });
        });
    } else{
        res.status(400).json('Incorrect Credentials');
    }
});
//frontend
  const login = async (e) => {
    e.preventDefault();
    const response = await fetch('http://localhost:4000/api/user/Login', {
      method: "POST",
      body: JSON.stringify({ username, password }),
      headers: { "Content-Type": "application/json" },
      credentials: "include"  
    });
    if(response.ok) {
      response.json().then(userInfo => {
        setUserInfo(userInfo);
        setRedirect(true);  
      });
    } else{
      alert('Incorrect Credentials~~Please enter Correct Credentials')
    }
  };

Hi can you share your site name/slug?

https://tiny-griffin-5923c6.netlify.app

You’re connecting to localhost, which won’t work. Also, you would have to convert the Express application to Netlify Functions, as Netlify doesn’t run Node.js applications without Netlify Functions.