Add serve_file method to route#725
Conversation
4f2d5b1 to
8f2208b
Compare
|
I added |
goto-bus-stop
left a comment
There was a problem hiding this comment.
I don't think an extension trait is necessary at this stage. There are only a few different methods on the trait, if you count the 10 HTTP method aliases as one 😜
Funny you put it that way. Because in my fluent routes crate I put all of those aliases in their own extension trait too :-) https://github.com/mendelt/tide-fluent-routes/blob/c20244d6e2254f275ebc0ad46ebed2c621ef90a6/src/routebuilder.rs#L27 But for now this might be a bit premature, and I'd want to put serve_dir in an extension trait too. And that will break backward compatibiltiy. So yeah, this might be for later if there are more routing helper methods. |
775b9f6 to
5ad0903
Compare
yoshuawuyts
left a comment
There was a problem hiding this comment.
Thanks so much for this PR @mendelt; this looks good!
In the past there's been talk about perhaps moving serve / serve_file into some sort of FileServer struct which would resemble much of how Tide's redirects work today. But we still need to finish up the design for that, and I don't think we should miss out on a chance to make serving single files easier until then.
Going to go ahead and merge this; thanks heaps!
|
Tested this locally, and clippy + rustfmt pass. We need to update the CI, but in the interim I think this is fine to merge as-is. Thanks! |
This pr adds a serve_file method alongside the already existing
serve_dirmethod.