📜  允许客户端发送的 cookie - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:34.838000             🧑  作者: Mango

代码示例1
const express = require("express")
const cors = require("cors");
const app = express();

app.use(cors({
  origin : http://localhost:3000 (Whatever your frontend url is) 
  credentials: true, // <= Accept credentials (cookies) sent by the client
})

app.use("/api/whatever/the/endpoint", yourRouter);