
서버단에서 쿠키 설정 후 브라우저에서 확인해보기
·
⭐FE
배경뜬금없이 서버단에서 쿠키값을 설정하고 브라우저에서 확인해보고 싶어 코드를 http모듈을 통해 로컬서버를 생성하고 브라우저를 통해 요청(request)과 응답(response)의 헤더를 통해 쿠키를 살펴보고 싶어져서 코드를 작성했습니다. 코드 & 설명// server.js// http module 사용const http = require("http");// server 생성const server = http.createServer((req, res) => { const cookie = req.headers["cookie"]; if (cookie && cookie.includes("isVisited")) { res.write("welcome again.\n"); res..