can't send even test data from backend(express) to frontend(react component) both of m servers are running but still icant receive data from backend.
what i receive is a readablestream and after decoding this i got react main page html page in the console.
backend code block ( index.js)
import express from 'express'
import cors from 'cors'
const app=express()
const PORT=3000||5000
const options={
origin:"my-react-localhost-which-i can't paste here",
method:"GET,POST,PUT,DELETE",
credentials:true
}
app.use(cors(options))
app.use(express.json())
app.get("/",(req,res)=>{
res.json({message:"i am index"}).status(200) or res.send({message:"i am index"}).status(200)
})
app.listen(PORT,()=>{
console.log(`App is running on port:${PORT}`)
})
App.jsx code(react component)
const getData=async()=>{
const response= await fetch('api-running-locally')
console.log(response)
return response;
}
useEffect(()=>{
getData()},[])
both my backend and frontend running but still i can't get anything