philippkueng / node-neo4j

Neo4j REST API wrapper for Node.js
MIT License
211 stars 44 forks source link

Cross-Origin Resource Sharing (CORS) support #64

Open flip111 opened 8 years ago

flip111 commented 8 years ago

I was trying to browserify this package so can quickly prototype some client side app without having to setup a server (apart from neo4j itself). Looking at these stackoverflow comments there is a problem with the neo4j server with the old cypher endpoint but everything should work fine with the transactional endpoint.

http://stackoverflow.com/a/26976950/1833322 http://stackoverflow.com/a/26686262/1833322 (comment)

so i just tried

var db = new neo4j('http://neo4j:neo4j@localhost:7474');
db.beginTransaction();

as i was guessing the beginTransaction function would do something with the transactional endpoint. But i'm still getting the CORS error:

XMLHttpRequest cannot load http://localhost:7474/db/data/transaction. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 401.