Answers for "cors error with node js"

0

how to remove cors error from node app

app.use(function(req, res, next) {
    res.setHeader('Access-Control-Allow-Origin', '*');
    res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
    res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
    res.setHeader('Access-Control-Allow-Credentials', true);
    next();
});
Posted by: Guest on April-23-2021
0

cors error in node js express

var cors = require('cors')

var app = express()
app.use(cors())
Posted by: Guest on September-13-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language