Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

To enable server-to-server and REST tools like Postman to access our API -

var whitelist = ['http://example.com']
var corsOptions = {
  origin: function (origin, callback) {
    if (whitelist.indexOf(origin) !== -1 || !origin) {
      callback(null, true)
    } else {
      callback(new Error('Not allowed by CORS'))
    }
  }
}

app.use(cors(corsOptions));
Comment

PREVIOUS NEXT
Code Example
Javascript :: getComments 
Javascript :: Full form of BOM in Javascript is 
Javascript :: javascript synchronous and asynchronous list 
Javascript :: create multidimensional array with foreach javascript 
Javascript :: jsx expressions 
Javascript :: "json" is not defined 
Javascript :: react native paper status bar color 
Javascript :: SH1 in react native 
Javascript :: toggle value change inline angular 
Javascript :: react-native-modal big border 
Javascript :: react spring bounce in animation 
Javascript :: Remove the minimum 
Javascript :: element non empty jquer y check 
Javascript :: angular reuse component with different data 
Javascript :: reloading init state 
Javascript :: sum properties some objects when merge their 
Javascript :: JSON Use Example 
Javascript :: Add Methods to a Constructor Function Using Prototype 
Javascript :: get file name with extension netsuite suitescript 
Javascript :: change jquery to javascript 
Javascript :: mvc return view with query string 
Javascript :: port for sqlexpress not found in desktop node.js 
Javascript :: how can i debug compressed javascript in chrome 
Javascript :: how to write dummy for loop in jsx 
Javascript :: repeater javascript 
Javascript :: difference between usecallback and usememo 
Javascript :: v-smooth-scroll 
Javascript :: unminify javascript 
Javascript :: how to compile javascript class to function 
Javascript :: Plumsail add a button to the left side of the toolbar, which will be hidden until an item is selected 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =