1const corsConfig = {
2 origin: true,
3 credentials: true,
4};
5
6app.use(cors(corsConfig));
7app.options('*', cors(corsConfig));
8
1server:
2res.setHeader('Access-Control-Allow-Origin', 'http://localhost:3000');
3res.setHeader('Access-Control-Allow-Credentials',true);
4
5client(axios):
6axios.defaults.withCredentials = true;
7