Skip to content

Conversation

sweatercomeback
Copy link
Contributor

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 /.

Copy link
Member

@NickCraver NickCraver left a 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) :)

popupShowTimeWithChildren = options.popupShowTimeWithChildren || popupShowTimeWithChildren;
popupRenderPosition = options.popupRenderPosition || popupRenderPosition;
storage = options.storage || storage;
resourcePath = `${options.resourcePath || ''}/${resourcePath}`;
Copy link
Member

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/

Copy link
Contributor Author

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

@coveralls
Copy link

coveralls commented Sep 23, 2019

Coverage Status

Coverage increased (+0.0006%) to 99.746% when pulling 01d58ab on sweatercomeback:master into fa9c21b on MiniProfiler:master.

Copy link
Member

@NickCraver NickCraver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks!

@NickCraver NickCraver changed the title adds configurable resourcePath Adds configurable resourcePath Dec 24, 2019
@NickCraver NickCraver merged commit bf623f6 into MiniProfiler:master Dec 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants