title: What file should i add this code to enable CORS in node js server?
body: <pre><code>var express = require('express')
  var cors = require('cors')
  var app = express()
  
  app.use(cors())
  
  app.get('/products/:id', function (req, res, next) {
    res.json({msg: 'This is CORS-enabled for all origins!'})
  })
  
  app.listen(80, function () {
    console.log('CORS-enabled web server listening on port 80')
  })
  </code></pre>
  
  <p>I am trying to enable CORS in my node js server. but I don't know to what file should I append the code above. Thanks in advance!</p>