darkhttpd
darkhttpd copied to clipboard
Add an option to serve a single file for all requests
Often, I want to just share a single file over HTTP. Right now, we can only pass a directory to darkhttpd
, and it will serve any file from that directory. I would love to be able to do darkhttpd ./my/single/file.html
.
Why not create a directory with the single file you want to serve?
@kugland the same reason I don't just spin up nginx instead: it's way less convenient.
I have this use case as well. I just need to serve a single HTML page on localhost, which I request using window.open()
on Chromium, then I register a ServiceWorker
from a script in the HTML which is used to stream data to the Tab which opened the window
. I don't even need darkhttpd
to remain active once the single request is served. I can use Native Messaging to start the local server, ideally the server would terminate itself once the request is served - the script and ServiceWorker
in the served HTML will remain active.
I can kinda appreciate this from a simplicity and security standpoint - locking serving down to a single path. Who wants to implement it?
I am not an expert in C. Otherwise I would file a PR as this is exactly what I am looking for for my own projects in the browser and potentially as a base to import into QuickJS.