From 8b8649c861ac17bce63d29d09b58d4c189607c3c Mon Sep 17 00:00:00 2001 From: swee Date: Sun, 12 Jan 2025 21:36:58 -0800 Subject: [PATCH] Add server.py --- server.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 server.py diff --git a/server.py b/server.py new file mode 100644 index 0000000..f07ee84 --- /dev/null +++ b/server.py @@ -0,0 +1,21 @@ +#!/usr/bin/python3 +import asyncio, traceback +from Flask import flask, request, render_template +from hypercorn.config import Config +from hypercorn.asyncio import serve +app = Flask(__name__) +@app.route("/") +def root(): + return render_template("home.html") +@app.route("/gem/") +def relay(url): + parsed = "

Something went wrong...

\n" + title = "Something went wrong..." + try: + raise Exception("Not implemented") + except: + parsed += traceback.format_exc() + return render_template("gem.html", code=parsed, title=title) + +# Run the Hypercorn ASGI server +asyncio.run(serve(app, Config())) \ No newline at end of file