“CORS Express Tutorial” Code-Antworten

CORs in Express

const cors = require('cors');

const corsOption = {
    origin: ['http://localhost:3000'],
};
app.use(cors(corsOption));
//if you want in every domain then
app.use(cors())
Shirshak kandel

CORS Express zulassen

app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "YOUR-DOMAIN.TLD"); // update to match the domain you will make the request from
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  next();
});
Poised Penguin

CORS Express Tutorial

$ npm install cors


const cors = require('cors');

const corsOption = {
    origin: ['http://localhost:3000'],
};
app.use(cors(corsOption));
Daniel Kristoffersen

Ähnliche Antworten wie “CORS Express Tutorial”

Fragen ähnlich wie “CORS Express Tutorial”

Weitere verwandte Antworten zu “CORS Express Tutorial” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen