“NPM CORS -API -Verwendung” Code-Antworten

NPM CORS -API -Verwendung

npm install cors
var cors = require("cors");

CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.
Ali Raza Arain

CORS -Paket Installation NPM

var express = require('express')var cors = require('cors')var app = express() app.get('/products/:id', cors(), function (req, res, next) {  res.json({msg: 'This is CORS-enabled for a Single Route'})}) app.listen(80, function () {  console.log('CORS-enabled web server listening on port 80')})
Disgusted Dotterel

CORS -Paket Installation NPM

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')})
Disgusted Dotterel

Ähnliche Antworten wie “NPM CORS -API -Verwendung”

Fragen ähnlich wie “NPM CORS -API -Verwendung”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen