➋
// 주소가 /login으로 시작하는 경우 if (req.url.startsWith('/login')) { const url = new URL(req.url, 'http://localhost:8084'); const name = url.searchParams.get('name'); const expires = new Date(); // 쿠키 유효 시간을 현재 시간 + 5분으로 설정 expires.setMinutes(expires.getMinutes() + 5); res.writeHead(302, { Location: '/', 'Set-Cookie': `name=${encodeURIComponent(name)}; Expires=${expires.toGMTString()}; HttpOnly; Path=/`, }); res.end();