I tried answers from other questions and used (updated from https://gist.github.com/balupton/3696140):
var http = require('http');
var cors = require('cors');
http.createServer(app).listen(3000).use();
function app(request, response) {
response.setHeader('Access-Control-Allow-Origin', '*');
response.setHeader('Access-Control-Request-Method', '*');
response.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');
response.setHeader('Access-Control-Allow-Headers', '*');
...
}
It returns: http.createServer(...).listen(...).use is not a function
After the update it runs but I am still getting 405 error on the client side.
useis not a method ofserver- perhaps this will shed some light - seeing as nodecorsis middleware for Express (or Connect) - it's not surprising your code won't work as ishttp.createServer(app).listen(3000).use(cors());... derp