“Tutorial CORS Express” Kode Jawaban

Cors di 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

Izinkan CORS Express

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

Tutorial CORS Express

$ npm install cors


const cors = require('cors');

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

Jawaban yang mirip dengan “Tutorial CORS Express”

Pertanyaan yang mirip dengan “Tutorial CORS Express”

Lebih banyak jawaban terkait untuk “Tutorial CORS Express” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya