Hi @seinsiedler ,
I'm not sure anyone is going to be able to provide best practices on this specific application. A lot of your questions are really user preference.
I can share my own experience on this topic though.
What library would you advise to use to host the HTTP server?
I have used Python Flask to host an HTTP image/video server that handles file sizes up to ~50MB.
Any HTTP client will work, but I could recommend Axios JS if working in an HTML frontend.
Should the URL be provided in the datalayer?
This depends on the architecture and functionality of your process. This doesn't necessarily need to be provided in the datalayer if it doesn't need to be shared with other processes.
What would be the/your preferred format for images?
Again, this is up to you. If you are using binary/base64 to encode the resources for transfer, it should support any type. I have used png, jpg and mp4.
Please let me know if you have any other questions! An example Flask server implementation is below.
from xml.etree.ElementTree import tostring
from flask import Flask
from flask_cors import CORS
import os
app = Flask(__name__,
static_url_path='',
static_folder='Resources/')
CORS(app)
dir_path = 'Resources/'
@app.route('/directories')
def directories():
dirs = []
try:
for path in os.scandir(dir_path):
if path.is_dir():
print(path.name)
dirs.append(str(path.name))
return dirs
except Exception as e:
print(e)
@app.route('/fileCount/<target>/<folder>')
def fileCount(target = None, folder = None):
print(dir_path + target +'/' + folder)
count = 0
try:
for path in os.scandir(dir_path + target +'/' + folder):
if path.is_file():
count += 1
return str(count)
except Exception as e:
print(e)
app.run(host="0.0.0.0")
... View more