-
Notifications
You must be signed in to change notification settings - Fork 125
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
File exclusion from glob route? #291
Comments
I have a similar problem, but to sending file only with .json file extension. Thanks. |
@danielpclark I don't believe the API supposed exclusion yet, but we'd be totally willing to accept a PR adding it! I wonder if @colinbankier has any thoughts on API methods for that? @yanganto for that you would have to expose that manually via |
Just thinking out loud… The fn get<'b>(&'b mut self, path: &str) -> DefaultSingleRouteBuilder<'b, C, P> {
self.request(vec![Method::GET], path)
} To something like this: fn get<'b>(&'b mut self, path: Into<FileCollection>) -> DefaultSingleRouteBuilder<'b, C, P> {
self.request(vec![Method::GET], path.into())
} And we'll of course have our own Since every type has The internals would be super simple to… pretty much a container for a Vec I'm thinking. Although I haven't looked too closely at the glob semantics but I think it's doable in a similar fashion. Further thinking, without looking into glob semantics, the trait Given {
fn given(&self, &str) -> Option<>;
} |
Maybe |
@danielpclark I think I'd prefer something like
|
Thanks @danielpclark - I hadn't put any thought into file exclusion yet. Sounds like a useful feature for sure. (Although I did wonder whether in some cases it's preferable to update your static assets pipeline to output only what you want instead.) |
@colinbankier Yes you've understood me. I wasn't sure where the acceptance and denial of routing occured and had assumed it was in the Adding
Yeah I've been thinking about this myself and I'll give you a scenario. ScenarioWe now have access to the entire JavaScript asset management system Webpack provides with the webpacker crate. This pre-processes and bundles assets of all types and places them in a public folder. Since JavaScript apps are often entirely client side loaded they've included a manifest file of all the generated asset output for the JavaScript client to potentially download. Since we're handling routing on the server with Gotham we don't need to deliver this file as we'll take care of the routingmanifest.json provides ourselves. Now the webpacker crate currently processes this file during the build phase of compilation and during deployment on a server like Heroku the files are made into a read only image. So if I wanted to change the manifest.json file directory I would need to move it before the build process and add the new path to the manifest creation command or move/remove it after the manifest is created... which is probably okay. ButSo your suggestion of the exclude method sounds much more preferable. |
Ok, great, thanks for the background on your scenario. |
Given
How can I exclude a
packs/manifest.json
file in that directory?The text was updated successfully, but these errors were encountered: