cors fixes

This commit is contained in:
Selvi 2026-06-22 19:58:19 +05:30
parent a6b29d98eb
commit 8247fffe36

View File

@ -7,7 +7,11 @@ const { generateShippingLabelPDF } = require('./shippingLabelGenerator');
const { sendEmailWithAttachment } = require('./mailer'); const { sendEmailWithAttachment } = require('./mailer');
const app = express(); const app = express();
app.use(cors()); // Allow frontend Shopify store to call this server app.use(cors({
origin: '*', // Allow all origins (you can restrict this to 'https://rayaarishop.com' in production)
methods: ['GET', 'POST', 'OPTIONS', 'PUT', 'PATCH', 'DELETE'],
allowedHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'Authorization', 'X-Shopify-Hmac-Sha256', 'X-Shopify-Access-Token']
})); // Allow frontend Shopify store to call this server
const PORT = process.env.PORT || 3000; const PORT = process.env.PORT || 3000;
// Middleware to capture raw body for Shopify webhook HMAC verification // Middleware to capture raw body for Shopify webhook HMAC verification