Cookie not show in browser : i try again and again but cookie send from backend but not store in browser, i also try another browser like chrome and microsoft bing
this is node js code and html, javascript
**backend code :
**
const express = require('express')
const cookieParser = require('cookie-parser')
const cors = require('cors')
const app = express();
app.listen(8080,()=>{
console.log("express")
})
app.use(cookieParser())
app.use(cors())
app.get('/login',(req,res)=>{
res.cookie('cookies','myid',{
httpOnly:true
}).json({msg:"cookies sended ! "})
})
**front end code :
**
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button onclick="myfunction()">Fetch</button>
<script>
const myfunction = async ()=>{
let res = await fetch('http://localhost:8080/login',{ method:"GET"})
res = await res.json()
console.log(res)
}
</script>
</body>
</html>
output in consol :
{ msg: 'cookies sended ! '}
i am expecting :
cookies store in browser