alpinjs
02/13/2023, 1:56 PMimport express from "express";
import cors from "cors";
import supertokens from "supertokens-node";
import { middleware } from "supertokens-node/framework/express";
let app = express();
app.use(cors({
origin: "http://localhost:3000",
allowedHeaders: ["content-type", ...supertokens.getAllCORSHeaders()],
credentials: true,
}));
// IMPORTANT: CORS should be before the below line.
app.use(middleware());
// ...your API routes
i've already set this config on my backend but it still not working. axios said to me cors error.rp_st
02/13/2023, 1:57 PMalpinjs
02/13/2023, 1:58 PMalpinjs
02/13/2023, 2:00 PMnkshah2
02/13/2023, 2:00 PMalpinjs
02/13/2023, 2:00 PMnkshah2
02/13/2023, 2:01 PMalpinjs
02/13/2023, 2:01 PMnkshah2
02/13/2023, 2:01 PMalpinjs
02/13/2023, 2:01 PMnkshah2
02/13/2023, 2:03 PMlocalhost:3000
or change your code snippet for cors to
app.use(cors({
origin: "http://127.0.0.1:3000",
allowedHeaders: ["content-type", ...supertokens.getAllCORSHeaders()],
credentials: true,
}));
alpinjs
02/13/2023, 2:06 PMrp_st
02/13/2023, 2:07 PMalpinjs
02/13/2023, 2:08 PMalpinjs
02/13/2023, 2:09 PMrp_st
02/13/2023, 2:10 PMrp_st
02/13/2023, 2:10 PMalpinjs
02/13/2023, 2:12 PMrp_st
02/13/2023, 2:12 PMAhmett
02/13/2023, 2:15 PMAhmett
02/13/2023, 2:17 PMrp_st
02/13/2023, 2:18 PMAhmett
02/13/2023, 2:18 PMrp_st
02/13/2023, 2:19 PMalpinjs
02/13/2023, 2:22 PMrp_st
02/13/2023, 2:35 PMrp_st
02/13/2023, 2:35 PMalpinjs
02/13/2023, 2:35 PMrp_st
02/13/2023, 2:36 PMrp_st
02/13/2023, 2:36 PMalpinjs
02/13/2023, 2:36 PMalpinjs
02/13/2023, 2:36 PMalpinjs
02/13/2023, 2:58 PM