1. What is CORS in Node.js and why is it needed?
CORS (Cross-Origin Resource Sharing) enables web apps running on one domain to access resources from another. The `cors` npm package sets headers to allow or restrict requests from other origins.
const cors=require('cors');
app.use(cors({origin:'*'}));