Last active
October 22, 2015 16:32
-
-
Save mtharrison/65ba1e7f6856df2ba8fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script> | |
var request = new XMLHttpRequest(); | |
request.open('GET', 'http://127.0.0.1:4000/cors', true); | |
request.setRequestHeader('x-custom-header', 'value'); | |
request.onload = function() { | |
}; | |
request.onerror = function() { | |
}; | |
request.send(); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Express = require('express'); | |
var Cors = require('cors'); | |
var app = Express(); | |
app.use(Express.static(__dirname)); | |
app.get('/cors', Cors(), function (req, res) { | |
res.end('cors'); | |
}); | |
app.listen(4000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment