memory node, neo4j grapph db
This commit is contained in:
6
store-all/api/Dockerfile
Normal file
6
store-all/api/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM python:3.9-slim
|
||||
WORKDIR /usr/src/app
|
||||
COPY requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
COPY . .
|
||||
CMD ["python", "app.py"]
|
30
store-all/api/app.py
Normal file
30
store-all/api/app.py
Normal file
@ -0,0 +1,30 @@
|
||||
from flask import Flask, jsonify, request
|
||||
from neo4j import GraphDatabase
|
||||
from pymilvus import connections, Collection
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
# Neo4j Connection
|
||||
neo4j_driver = GraphDatabase.driver("bolt://neo4j:7687", auth=("neo4j", "testpassword"))
|
||||
|
||||
# Milvus Connection
|
||||
connections.connect("default", host="milvus", port="19530")
|
||||
|
||||
@app.route('/')
|
||||
def home():
|
||||
return jsonify({'message': 'Hello, World!'})
|
||||
|
||||
@app.route('/neo4j_test')
|
||||
def neo4j_test():
|
||||
with neo4j_driver.session() as session:
|
||||
result = session.run("MATCH (n) RETURN count(n) AS count")
|
||||
count = result.single()["count"]
|
||||
return jsonify({'neo4j_node_count': count})
|
||||
|
||||
@app.route('/milvus_test')
|
||||
def milvus_test():
|
||||
collections = Collection.list()
|
||||
return jsonify({'milvus_collections': collections})
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=5000)
|
4
store-all/api/requirements.txt
Normal file
4
store-all/api/requirements.txt
Normal file
@ -0,0 +1,4 @@
|
||||
Flask==2.0.3
|
||||
neo4j==4.4.1
|
||||
pymilvus==2.0.2
|
||||
gunicorn==20.1.0
|
Reference in New Issue
Block a user