Complete the code to import the CORS middleware.
const cors = require('[1]');
The CORS middleware is imported using require('cors').
Complete the code to apply CORS middleware globally in the Express app.
app.use([1]());Use cors() as middleware to enable CORS for all routes.
Fix the error in the CORS options object to allow only requests from 'https://example.com'.
app.use(cors({ origin: [1] }));Setting origin to the specific URL string restricts CORS to that domain.
Fill both blanks to configure CORS to allow credentials and restrict origin to 'https://myapp.com'.
app.use(cors({ origin: [1], [2]: true }));Set origin to the allowed URL and credentials to true to allow cookies and auth headers.
Fill all three blanks to create a CORS middleware that allows origin 'https://site.com', credentials, and only GET and POST methods.
app.use(cors({ origin: [1], [2]: true, [3]: ['GET', 'POST'] }));Set origin to the allowed URL, credentials to true, and methods to the allowed HTTP methods array.