-
-
Notifications
You must be signed in to change notification settings - Fork 59
Replace http-server
with fastify
#101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
abc4f51
to
f84f33a
Compare
I used to have my own custom server implementation using express, but being able to access the user's file system kinda deprecated the need for a backend server. Nowadays I keep web server support mostly for my own use at home (cheap NAS running lighttpd), but I think it also benefits those who want to self-host the app in any standard web server. If I need to move to a custom server, there's no point in keeping it.
But I believe range requests are enabled by default in most web servers, no? It seems to be, on my NAS server..
|
Scraping files from HTML is inherently brittle, any changes to the DOM or structure will break the logic. If you want true support for multiple server configurations, it's better to use a protocol designed for that purpose, like WebDAV, which offers standardized, structured access over HTTP. |
f84f33a
to
a5b6f60
Compare
What you may want to consider, if you cannot live without your static webserver, is to create a proxy, scraping and converting the HTML pages to REST/JSON. |
I’m definitely interested in supporting other data sources/protocols like WebDAV in the future, but I don't want to abruptly break compatibility. I truly appreciate your help, enthusiasm and patience - it means a lot. But for now, I need to focus on documenting this new version for release. My availability for this project is limited at the moment, so I’ll have to put these ideas on hold for maybe a couple of weeks. I hope you understand. |
Thanks for the heads up @hvianna , understood, first things first. |
a5b6f60
to
3f6a084
Compare
Communicate directory listings in JSON. Switch module from CommonJs to ECMAScript, consistent with front-end code.
3f6a084
to
ab1bf5c
Compare
Replace
http-server
withfastify
.Rational
While http-server is excellent for quickly serving static files to a browser, it is not intended to function as a backend API for web applications. It responds with HTML directory listings and lacks support for structured responses like JSON, which are essential when building RESTful services or programmatic file access. If your application needs to interact with the server via JavaScript (e.g., fetch or AJAX) and expects machine-readable data (e.g., JSON), a more suitable approach is to use a lightweight Node.js server (e.g., with Express or Fastify) that can explicitly serve both static files and JSON-based endpoints.
Other
Switch server side / module type from CommonJS to ECMAScript.
New options