aboutsummaryrefslogtreecommitdiff
path: root/src/main.py
diff options
context:
space:
mode:
authorJoris2024-06-02 14:38:13 +0200
committerJoris2024-06-02 14:38:22 +0200
commit1019ea1ed341e3a7769c046aa0be5764789360b6 (patch)
tree1a0d8a4f00cff252d661c42fc23ed4c19795da6f /src/main.py
parente8da9790dc6d55cd2e8883322cdf9a7bf5b4f5b7 (diff)
Migrate to Rust and Hyper
With sanic, downloading a file locally is around ten times slower than with Rust and hyper. Maybe `pypy` could have helped, but I didn’t succeed to set it up quickly with the dependencies.
Diffstat (limited to 'src/main.py')
-rw-r--r--src/main.py28
1 files changed, 0 insertions, 28 deletions
diff --git a/src/main.py b/src/main.py
deleted file mode 100644
index b678aae..0000000
--- a/src/main.py
+++ /dev/null
@@ -1,28 +0,0 @@
-import sanic
-import os
-
-import controller
-
-app = sanic.Sanic("Files")
-
-@app.get("/")
-async def index(request):
- return controller.index()
-
-@app.post("/", stream = True)
-async def upload(request):
- return await controller.upload(request)
-
-@app.get("/<file_id:str>")
-async def file_page(request, file_id):
- return await controller.file(file_id, download = False)
-
-@app.get("/<file_id:str>/download")
-async def file_download(request, file_id):
- return await controller.file(file_id, download = True)
-
-app.static("/static/", "static/")
-
-if __name__ == "__main__":
- debug = 'DEBUG' in os.environ and os.environ['DEBUG'] == 'TRUE'
- app.run(debug=debug, access_log=True)