Skip to content

Commit

Permalink
allowed credentials in cors
Browse files Browse the repository at this point in the history
  • Loading branch information
anirvinv committed Apr 11, 2024
1 parent b81d711 commit 7540925
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion backend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const DEV = process.env.NODE_ENV === "DEV";

// Add this middleware to parse JSON request bodies
app.use(express.json());
app.use(cors());
app.use(cors({
credentials: true
}));
app.use(cookieParser());

app.use("/admin", adminRoute);
Expand Down
4 changes: 3 additions & 1 deletion backend/public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ const port = process.env.PORT;
const DEV = process.env.NODE_ENV === "DEV";
// Add this middleware to parse JSON request bodies
exports.app.use(express_1.default.json());
exports.app.use((0, cors_1.default)());
exports.app.use((0, cors_1.default)({
credentials: true
}));
exports.app.use((0, cookie_parser_1.default)());
exports.app.use("/admin", admin_route_1.default);
exports.app.use("/volunteer", volunteer_route_1.default);
Expand Down

0 comments on commit 7540925

Please sign in to comment.