Skip to content

Refactor #495: Moved CORS configuration into a dedicated ES module co…#517

Open
jikrana1 wants to merge 2 commits into
niharika-mente:mainfrom
jikrana1:refactor/issue-495-cors-module
Open

Refactor #495: Moved CORS configuration into a dedicated ES module co…#517
jikrana1 wants to merge 2 commits into
niharika-mente:mainfrom
jikrana1:refactor/issue-495-cors-module

Conversation

@jikrana1

Copy link
Copy Markdown
Contributor

📋 Pull Request — Refactor CORS into ES Module (Issue #495)

🔗 Related Issue

Closes #495Refactor CORS Configuration into a Dedicated Configuration Module

✅ Changes Made

  • Extracted the allowedOrigins logic and cors() configuration callback from app.js.
  • Created a new ES Module file config/cors.js to centralize all CORS settings.
  • Exported the configured corsMiddleware using ES Module export default syntax.
  • Imported and applied the new middleware in app.js.

🧪 Testing Checklist

  • Server starts successfully.
  • API calls from localhost (development) still work perfectly.
  • API calls from the production FRONTEND_URL still work perfectly.
  • The app's CORS behavior remains completely unchanged.

📌 Benefits Achieved

  • Cleaner app.js entry point.
  • Better Separation of Concerns.
  • Easier maintenance (add/remove origins in a single file).

@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the niharika-mente's projects Team on Vercel.

A member of the Team first needs to authorize it.

Aamod007
Aamod007 previously approved these changes Jul 2, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aamod007 Aamod007 self-requested a review July 2, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor CORS Configuration into a Dedicated Configuration Module

2 participants