0

I am integrating Neo4j into my angular and nodejs application. I have to access the Neo4j database using bolt url as http doesn't work in my case.

Because i am getting error in console as -

 Response with status: 0  for URL: null

and

  Failed to load http://localhost:11002/viewNodesStart: Response for 
  preflight has invalid HTTP status code 404.

Angular code -

app.component.ts

   export class Neo4jPrimaryComponent implements OnInit {

   constructor(private http: Http,  private notify: ToasterService) { 
    }

 ngOnInit() {
  this.viewNodesStart();
   }


 emptyObj;
 info;

   // -------------------------------  Nodes Entire Data -------------

  viewNodesStart() {

  console.log("INSIDE viewNodesStart()")

// Nodes Value

   console.log("inside Nodes Value");
   var data = localStorage.getItem('token');
    console.log("data is=>",data);
   var url = config.url;
   var port = config.port;

 'Bearer ' + localStorage.getItem('token') }) }
this.http.post("http://"+url+":"+port+"/viewNodesStart",this.emptyObj,
  { headers: new Headers({ 'Authorization': 'Bearer ' + 
   localStorage.getItem('token') }) } )
  .map(Response => Response.json())
   .subscribe((res: Response) => {

     console.log("XXXXXXXXXXXX", res);

     this.info = res;

     console.log('success', this.info.statusCode);
     if (this.info.statusCode == 200) {
      this.notify.Success("Data added successfully");

     } else {
      this.notify.Error("Data is not inserted")

     }
     });

    }

   }
Charlotte Skardon
  • 6,220
  • 2
  • 31
  • 42
Techdive
  • 997
  • 3
  • 24
  • 49
  • I don't see token-based authentication for Neo4j in the docs. ( https://neo4j.com/docs/developer-manual/current/http-api/authentication/) Have you tried basic auth?? Have you tried making the same request through Postman? Check out the list of clients: https://boltprotocol.org/ – Himanshu Jain Oct 09 '18 at 01:59
  • hi himanshu, can you help me once again. I want to display the output in my HTML. How to do it. Here is my angular2 and nodejs code --> https://stackoverflow.com/questions/52741184/unable-to-attach-an-res-sendresult-in-my-nodejs-to-send-data-to-angular-app and Here is the javascript code given by NodeJS community, i want to translate it in my angular and nodejs app - https://stackoverflow.com/questions/52681565/how-to-convert-the-javascript-file-to-angular2-and-nodejs-app – Techdive Oct 11 '18 at 08:57

0 Answers0