Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

allow cookies sent by the client

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);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #cookies #client
ADD COMMENT
Topic
Name
5+4 =