how to get all nodes in browser

215 views Asked by At

I have an issue in viewing all my nodes in browser,but i can can print it in terminal.i need all my nodes to be returned in json format but i getting error 500 internal server error and printing in termianl here is my code

from flask import Flask,render_template,request,url_for,json,jsonify
from py2neo import neo4j,Graph,Node,Relationship,cypher
import json


app = Flask(__name__)
gdb = GraphDatabase("http://neo4j:duke@localhost:7474/db/data")
graph=Graph("http://neo4j:duke@localhost:7474/db/data")

@app.route('/',methods=['GET'])
def index():
    results = graph.cypher.execute("MATCH (n) RETURN n")
    if request.method=='GET':
         return jsonify(results)



@app.route('/enter',methods=['GET','post'])
def enter_products():
    if request.method=='GET':
        return render_template('g.html')
    else:
        show_entry_form()


@app.route('/enter1')
def enter1():
    vera=Node("person",name="veeera")
    graph.create(vera)
    return vera

@app.route('/catogeries',methods=['get','post'])
def catogeries():   
    query=graph.cypher.execute("MATCH (n:Categories) RETURN n")
    return query

if __name__ == '__main__':
     app.run()
0

There are 0 answers