-
Notifications
You must be signed in to change notification settings - Fork 26
Adds configurable resourcePath #9
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
Conversation
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.
Good suggestion!
I did fine one issue: there's one issue with double slash pathing - we should check if the pass-in path has a trailing slash, and if so remove it before concatenating (and remove the /
in the concatenation itself) :)
lib/miniprofiler.js
Outdated
popupShowTimeWithChildren = options.popupShowTimeWithChildren || popupShowTimeWithChildren; | ||
popupRenderPosition = options.popupRenderPosition || popupRenderPosition; | ||
storage = options.storage || storage; | ||
resourcePath = `${options.resourcePath || ''}/${resourcePath}`; |
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.
With token-based replacement, wouldn't this result in a double //
before the last segment? e.g. /prefix//mini-profiler-resources/
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.
Good catch! I am now stripping any trailing slashes from options.resourcePath
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.
👍 Thanks!
This change allows you to modify the resourcePath with a subdirectory through configuration options:
miniprofiler.configure({ resourcePath: '/myapproot' }); app.use(miniprofiler.express());
This allows miniprofiler resources to load if your app root is not /.