类比于后台服务器的使用
//登录接口
app.get('/login',(req,res)=>{
//假如现在这里已经验证了账号和密码,是正确的,是可以登录的
//服务器就会吧cookie响应回去
res.writeHead(200,{
'Content-Type':'text/plain; charset=utf-8',
"Set-Cookie":'userid=123456'
})
res.end()
})
//查询接口
app.get('/list',(req,res)=>{
//接收一下客户端(浏览器端)自动自动带过来的cookie
console.log(req.headers)
res.send('333')
})