node.js - neo4j.ClientError: [Neo.ClientError.Security.Unauthorized] -


i'm new neo4j tried insert data neo4j database via node4js error has occurred resolve problem.

var express=require("express"); var app=express(); var neo4j=require('neo4j'); var neo4jdb = new neo4j.graphdatabase('http://localhost:7474/browser'); var crypto=require('crypto'); var bodyparser = require('body-parser'); app.use(bodyparser.urlencoded({ extended: true })) var appsecret=process.env.app_secret; app.get('/',function (req,res){     res.send("hello world"); })  app.get('/index',function(req,res){     res.sendfile('test.html',{'root': __dirname }); })  app.post('/insert',function (req,res){      var email = req.body['email'];      var password = req.body['password'];           var query = [              'create (user:user {newuser})',                  'return user'             ].join('\n');      var params = {          newuser: {            email: email,            password: password,          }      };                               neo4jdb.cypher({        query: query,           params: params        },         function(err,user){          if(err) throw err;          console.log(user);          res.send("record has been inserted")      }); }) app.listen(8000); 

your neo4j server requires authentication (the default setting), have provide username , password connect it.

according documentation "neo4j" npm package, done in url of neo4j server:

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

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -