https://www.npmjs.com/package/cookie

 

cookie

HTTP server cookie parsing and serialization. Latest version: 0.5.0, last published: 10 months ago. Start using cookie in your project by running `npm i cookie`. There are 3494 other projects in the npm registry using cookie.

www.npmjs.com

쿠키 사용하기 위해

$ npm install cookie

명령어 이용해서 설치.

 

 

 

쿠키 사용 위해 react 코드 맨 위에 

var cookie = require('cookie');

선언해주기.

 

 

 

 

 

 

 

 

 

 

 

 

 

1
2
3
4
5
6
7
8
9
10
11
const getLogin = (req, res) => {
  axios
    .post("url"null, {
      params: { name1: "value1", name2: "value2", name3: "name3", ....},
    })
    .then((response) => {
      res.cookie('SESSION', response.data.sessionId, {domain : 'localhost', path:'/', httpOnly : true, session : true});
      res.cookie('abcd', response.data.sessionId, {domain : 'localhost', path:'/', httpOnly : true, session : true});
    
    });
};
 
cs

res => 응답

res.cookie 로 쿠키 세팅.

 

 

 

 

 

 

 

 

▲ 쿠키 생김

 

 

 

 

 

 

 

 

 

 

 

https://chrome.google.com/webstore/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm

 

Cookie-Editor

Simple yet powerful Cookie Editor that allow you to quickly create, edit and delete cookies without leaving your tab.

chrome.google.com

chrome  에서 쿠키 보려면 쿠키에디터 설치하면 된다.

'공부 > Node.js' 카테고리의 다른 글

node.js 프로젝트 생성  (0) 2023.02.06
axios request cookie 설정  (0) 2023.02.02

+ Recent posts