I have an Angular7 frontend, and I am trying to send a get request from my Node server. However the Node server is unable to receive the api request itself.
I tried both on node's app.js code: 1>
const cors = require('cors');
app.use(cors());
2>
app.use((req,res,next)=>{
res.header('Access-Control-Allow-Origin', 'http://localhost:4200');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With,
Content-Type, Accept');
next();
})