Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Origin http://localhost:3002 is not allowed by Access-Control-Allow-Origin.

var http = require('http');

http.createServer(function (request, response) {
response.writeHead(200, {
    'Content-Type': 'text/plain',
    'Access-Control-Allow-Origin' : '*',
    'Access-Control-Allow-Methods': 'GET,PUT,POST,DELETE'
});
response.end('Hello World
');
}).listen(3000);
Comment

Origin http://localhost:3002 is not allowed by Access-Control-Allow-Origin.

var allowCrossDomain = function(req, res, next) {
    res.header('Access-Control-Allow-Origin', "*");
    res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
    res.header('Access-Control-Allow-Headers', 'Content-Type');
    next();
}
Comment

Origin http://localhost:3002 is not allowed by Access-Control-Allow-Origin.

app.configure(function() {
    app.use(allowCrossDomain);
    //some other code
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: Discord.client on 
Javascript :: update an array element with an array in mongoose 
Javascript :: javascript cheatsheet 
Javascript :: spread and rest operator javascript 
Javascript :: react native share link 
Javascript :: label animation css 
Javascript :: strict type javascript 
Javascript :: javascript clear an array 
Javascript :: invertir un array javascript 
Javascript :: jest write test for function 
Javascript :: custom eslint config react hooks 
Javascript :: exclude vales from array in js 
Javascript :: node query selector 
Javascript :: javascript, dynamic variable, and function to add data to O 
Javascript :: js get location params 
Javascript :: react native bottom sheet 
Javascript :: node express mongo boilerplate with jwt 
Javascript :: how to draw circle in javascript 
Javascript :: shape of array in js 
Javascript :: formdata upload file 
Javascript :: react table with styles 
Javascript :: dropdown hide 
Javascript :: how to use private github repo as npm dependency 
Javascript :: vue radio checked if 
Javascript :: javascript grpc timestamp 
Javascript :: how to access ::after Pseudo-Elements from javascript 
Javascript :: data attribute hide & show function syntax in jquery 
Javascript :: javascript set() method 
Javascript :: useeffect componentdidmount 
Javascript :: Map put() method 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =