Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of working with traces #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,18 @@ app.get('/drWho/linked_from_node/:node_id/:relation', function(req, res) {
});

app.all('/drWho/get_properties_of_node/:node_id', function(req, res) {
var data = "";
req.setEncoding('utf8');
req.on("data", function(chunk) { data += chunk });
req.on('end', function() {
console.log(data)
api.get_properties(req.params.node_id).then(resultJson => {
res.setHeader('Content-Type', 'text/plain');
res.end(resultJson);
});
});
});






app.get('/', function(req, res){
res.sendFile(__dirname + '/Index.html');
});
Expand Down
22 changes: 11 additions & 11 deletions neo4j.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function All_nodes(){
const node = singleRecord.get(0);
const node_obj = {
name: node.labels[0],
trace:[],
trace:["345"],
returns:{"kind":"nested","endpoint":"/nodes_of_type/"+node.labels},

}
Expand Down Expand Up @@ -64,13 +64,13 @@ function nodes_of_type(label_type){
return {
name: node.properties.name,
returns:{"kind":"nested","endpoint":"/links_from_node/"+node.properties.name},
trace:[]
trace:["abc"]
} });

var any = {
name: "any",
returns:{"kind":"nested","endpoint":"/links_from_any_node/" + label_type},
trace:[]
trace:["def"]
};
jsonArray.push(any);
var jsonString = JSON.stringify(jsonArray);
Expand Down Expand Up @@ -109,7 +109,7 @@ function links_from_any_node(label_type){
var jsonString = "";
const prop_obj = {
name: "get_properties",
trace:[],
trace:["geh"],
returns:{
kind:"primitive",
type: {name:"seq", params:[
Expand All @@ -127,7 +127,7 @@ function links_from_any_node(label_type){
if (node != null) {
const node_obj = {
name: node,
trace:[],
trace:["ijk"],
returns:{"kind":"nested","endpoint":"/linked_from_node/"+ "any" + "/"+ node},
}
jsonString += JSON.stringify(node_obj) + ";";
Expand Down Expand Up @@ -181,7 +181,7 @@ function links_from_node(node_id){
var jsonString = "";
const prop_obj = {
name: "get_properties",
trace:[],
trace:["lmn"],
returns:{
kind:"primitive",
type: {name:"seq", params:[
Expand All @@ -199,7 +199,7 @@ function links_from_node(node_id){
if (node != null) {
const node_obj = {
name: node,
trace:[],
trace:["opq"],
returns:{"kind":"nested","endpoint":"/linked_from_node/"+ node_id + "/"+ node},
}
jsonString += JSON.stringify(node_obj) + ";";
Expand Down Expand Up @@ -239,13 +239,13 @@ function linked_any(link){
id: node.identity.toNumber(),
name: node.properties.name,
properties: node.properties,
trace:[],
trace:["rst"],
returns:{"kind":"nested","endpoint":"/links_from_node/"+node.properties.name},
} });
var any = {
name: "any",
returns:{"kind":"nested","endpoint":"/links_from_any_node/" + result.records[0].get(1)},
trace:[]
trace:["uvw"]
};
jsonArray.push(any);
var cache = {};
Expand Down Expand Up @@ -277,13 +277,13 @@ function linked_from_node(name, link){
id: node.identity.toNumber(),
name: node.properties.name,
properties: node.properties,
trace:[],
trace:["xyz"],
returns:{"kind":"nested","endpoint":"/links_from_node/"+node.properties.name},
} });
var any = {
name: "any",
returns:{"kind":"nested","endpoint":"/links_from_any_node/" + result.records[0].get(1)},
trace:[]
trace:["012"]
};
jsonArray.push(any);
var cache = {};
Expand Down