如何在浏览器中获取所有节点

时间:2015-06-18 13:25:13

标签: json neo4j py2neo

我在查看浏览器中的所有节点时遇到问题,但我可以在terminal.i中打印它需要我的所有节点以json格式返回但是我收到错误500内部服务器错误并且在termianl中打印这里是我的代码

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 个答案:

没有答案