-
Notifications
You must be signed in to change notification settings - Fork 313
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
Serve site from fs #70
Conversation
lib/ocamlorg_web/router.ml
Outdated
Lwt_io.(with_file ~mode:Input file) (fun channel -> | ||
let open Lwt.Syntax in | ||
let* content = Lwt_io.read channel in | ||
Dream.respond ~headers content)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't Dream.from_filesystem
better than constructing a manual response here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a custom handler because the requested path is not the path of the file we want to serve (i.e. we need to add an index.html
if it's not there)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(The IO code is taken from Dream.from_filesystem
)
This LGTM if it is ready to go (I'm guessing this is the last thing blocking having continuous deployment via ocurrent deployer?) |
Thanks for the review @patricoferris! I think it is, @avsm needed this when working on the deployment. I'll merge now. |
add list tutorial and port to mdx
Updates the v3.ocaml.org static file serving to read the files from the filesystem instead of crunching them at compile time.
The path of the site dir can be set at runtime time with the
OCAMLORG_SITE_DIR
env variable.cc @avsm