-
Notifications
You must be signed in to change notification settings - Fork 554
Closed
Description
Similar to the example code:
server["/desktop/:path"] = shareFilesFromDirectory("/Users/me/Desktop")I would like to do something like this (but it doesn't work, even reversing the order of the two statements):
server["/:path"] = shareFilesFromDirectory("/Users/me/Sites/test")
server["/vendor/:path"] = shareFilesFromDirectory("/Users/me/Sites/vendor")This would enable the HTML inside the test directory to assume it's in the web root, and would also allow it to reference vendor libs (eg jQuery) from /vendor/jquery.js.
Unfortunately Swifter doesn't allow this, as it seems the first handler whose regex matches the path will be used, even if it returns a 404.
Symlinks might be a solution except I have other factors which preclude them.
So my question is: is it possible to craft a symlink to match all, but to preclude a specific path? eg something like:
// match anything, so long as it doesn't begin with `/vendor`
server["!{/vendor}/:path"] = shareFilesFromDirectory("/Users/me/Sites/test")
server["/vendor/:path"] = shareFilesFromDirectory("/Users/me/Sites/vendor")My regex is awful at best, so hoping someone might be able to help.
pcoltau
Metadata
Metadata
Assignees
Labels
No labels