Closed pickfire closed 4 years ago
devserver
's only additional feature that http
does not have is the ability to refresh the page when a file changes. http
supports a bunch of features that devserver
does not.
The bigger difference is that devserver
aims to be really really simple. The goal of this crate is to be an ultra-lean tool for serving static websites with almost no configuration.
Just to compare cargo install
times (as an approximate way to measure simplicity): devserver
builds / installs in 35 seconds and http
builds / installs in 2 minutes 50 seconds.
The entire devserver
crate is only 909 lines of code, and 573 of those are just a giant match statement for mime
types.
devserver's only additional feature that http does not have is the ability to refresh the page when a file changes. http supports a bunch of features that devserver does not.
Have you thought about adding that feature in http
as well? Because IIRC http
also aims to be zero-config.
The entire devserver crate is only 909 lines of code, and 573 of those are just a giant match statement for mime types.
Yes, http
is slower but it comes with a pack of stuff.
You raise a good point. To be honest I didn't know about http
until you pointed it out. I'd be happy to explain the approach devserver
uses for automatic reloading if they'd like to add it to http
as well.
The gist of the approach is that a tiny bit of Javascript is injected into every HTML page. That Javascript listens on a websocket for any signal from the server, and when it receives a signal it refreshes the page.
I don't want to directly implement it for http
myself because I'm not sure how the feature would interact with the rest of http
, but I imagine it wouldn't be too hard for someone familiar with http
to add.
https://github.com/thecoshman/http/issues/112 I opened an issue in http regarding this feature. @kettle11 thanks for pointing that out.
Looks like http are not looking into live reload feature.
That's too bad. Their response to you was pretty rude too.
If you end up using devserver
please open issues if you run into any problems. I'm trying to keep devserver
minimalist, but I'm also open to adding features that people think are important.
What is the difference between this crate and http (host these things please) crate https://github.com/thecoshman/http? I saw that this have live-reload.