Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/just-cameron/mongo-hack.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536# ENV["FIREWORKS_API_KEY"] = "bm38HrH82R4Qc2AdindG4xSHlVb9AlJMcNWyoRAH0akh1Mze"# ENV["SSL_CERT_DIR"] = "/etc/ssl/certs/"# ENV["MONGO_CONNSTRING"] = "mongodb+srv://cameron:testing123@mongo-hackathon.4lo2sdu.mongodb.net/?retryWrites=true&w=majority&appName=mongo-hackathon?tlsCAFile=/etc/ssl/certs/ca-certificates.crt"
import osfrom flask import Flask, request, jsonifyfrom pymongo import MongoClient
app = Flask(__name__)
# Connect to MongoDBmongo_connstring = os.environ["MONGO_CONNSTRING"]client = MongoClient(mongo_connstring)db = client.data
@app.route('/text', methods=['POST'])def handle_text(): # Get the text from the request text = request.json['text'] # TODO: Process the text and generate x and y x = "example_x" y = "example_y" # Return the response as JSON response = { "documents": text, "x": x, "y": y } return jsonify(response)
if __name__ == '__main__': app.run()