Complete the code to import the CORS middleware in a Node.js Express app.
const express = require('express'); const cors = require('[1]'); const app = express();
The cors package is imported to enable CORS middleware in Express.
Complete the code to enable CORS for all routes in the Express app.
app.use([1]());Using cors() as middleware enables CORS for all routes.
Fix the error in the CORS options object to allow only 'https://example.com'.
const corsOptions = {
origin: [1]
};The origin option should be a string with the allowed domain.
Fill both blanks to apply CORS middleware with options and start the server on port 3000.
app.use([1](corsOptions)); app.listen([2], () => console.log('Server running'));
Use cors(corsOptions) to apply CORS with options, and listen on port 3000.
Fill all three blanks to create a CORS options object allowing methods GET and POST, origin 'https://site.com', and enable credentials.
const corsOptions = {
origin: [1],
methods: [2],
credentials: [3]
};The origin is a string, methods is an array of allowed methods, and credentials is a boolean.