-
Notifications
You must be signed in to change notification settings - Fork 302
Add an embedded web server #982
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
Conversation
(I'm not yet trying to do any fancy monitoring of changes to the files and subsequent regeneration. This is all meant to be very bare bones.) To accomplish this I had to make the main crate callable from other crates, which in turn required some small changes to how it pulls in its own child modules, since `main` can no longer assume it is the crate root.
Yeah, the worry I have with this is the compile time increase, as we're now pulling tokio, hyper and other heavyweight dependencies. I'm not opposed to including the web server, but it must not cause compile time increases. A way to do that would be to setup the repo as a workspace and add the dependencies only to the |
The file approach won’t work for me; I do my development on a distinct box from where I do the preview I’ll look into the variant that Pietro proposed. |
Maybe use tiny_http? It is a light weight http server with only a few dependencies. Including dependencies (part of which are probably already used here) it takes 10s to compile in debug mode, 15s in release mode and 7s with cg_clif. |
FWIW, if this is the problem, I have no objections to us printing "run python3 -m http.server output/ or open file:///..." or some similar message after running the blog, that seems like an easy change to make and a good improvement regardless. |
Every time I want to write a blog post, I have to go look up what way to invoke
python http
or whatever to get a locally visible preview of my work.Today I decided to try something different.