-
Notifications
You must be signed in to change notification settings - Fork 2
feat!: add ignore_paths parameter (replaces ignore_dirs) #6
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
feat!: add ignore_paths parameter (replaces ignore_dirs) #6
Conversation
static-serve-macro/src/lib.rs
Outdated
|
|
||
| impl Parse for IgnoreFilesWithSpan { | ||
| fn parse(input: ParseStream) -> syn::Result<Self> { | ||
| let files = parse_dirs(input)?; // reuse parse_dirs since it's just parsing paths |
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.
NIT: should we rename parse_dirs into parse_paths?
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.
Yes, I think so. And the inner variables of the parse_dirs/parse_paths function should be renamed accordingly to avoid future confusion.
And after renaming the helper function @structwafel can remove the comment here, too.
static-serve/tests/tests.rs
Outdated
| let (parts, _) = response.into_parts(); | ||
| assert!(parts.status.is_success()); | ||
|
|
||
| // Request for index.html should return 404 since it's ignored |
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.
This should be app.js not index.html, right?
static-serve/tests/tests.rs
Outdated
| // app.js should be ignored, but styles.css should be available | ||
| assert!(router.has_routes()); | ||
|
|
||
| // Request for app.js should succeed |
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.
And here app.js should be styles.css?
|
Thanks a lot! I think it's a great addition. Once you change the name of the |
12f9b8f to
08c48cc
Compare
08c48cc to
f0f5b01
Compare
paolobarbolini
left a comment
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.
LGTM. Thanks for the PR
|
Released in v0.4.0 |
I wanted to serve my index.html differently than the rest of my static files.
(to add a middleware on / )
After hours of pain, and trying other libraries. I thought an option was to have an ignore_files option.
That way you can ignore those files, and serve things how you want.
Perhaps there is a smarter way to setup my project, will try to play with it a bit to see if it is actually useful.