쿠키공유
Credential
서버측
app.use(cors({ origin: "*" }));app.use(
cors({
origin: "http://localhost:3000",
credentials: true, //쿠키공유
})
);프론트
Last updated
app.use(cors({ origin: "*" }));app.use(
cors({
origin: "http://localhost:3000",
credentials: true, //쿠키공유
})
);Last updated
async function addCommentAPI(data) {
const response = await axios.post(`/post/${data.postId}/comment`, data, {
withCredentials: true,
});
return response.data;
}axios.defaults.baseURL = "http://localhost:3030";
axios.defaults.withCredentials = true;