eliminate baseDir and support mounting, close #235
As addressed in #235 , baseDir is eliminated and mounting is supported to achieve the same purpose.
Instead of
app.use(ecstatic({.., baseDir: "a"}));,
we now do:
app.use('/a', ecstatic({..}));.
Codecov Report
Merging #237 into master will decrease coverage by
0.46%. The diff coverage is0%.
@@ Coverage Diff @@
## master #237 +/- ##
==========================================
- Coverage 75.41% 74.95% -0.47%
==========================================
Files 9 9
Lines 541 539 -2
Branches 125 127 +2
==========================================
- Hits 408 404 -4
Misses 46 46
- Partials 87 89 +2
| Impacted Files | Coverage Δ | |
|---|---|---|
| lib/ecstatic/opts.js | 77.96% <ø> (ø) |
:arrow_up: |
| lib/ecstatic.js | 72.5% <0%> (-0.53%) |
:arrow_down: |
| lib/ecstatic/show-dir/index.js | 73.41% <0%> (-1.59%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 818744f...6962ece. Read the comment docs.
@jfhbrook The codecov check fails. Does that mean I need add tests? I'm not familiar with coverage tools and how they count. You can review my changes and tell me if there's anything I need to do.
@panlina I guess you do not need the complex processing,
Just wrap ecstatic simply by https://github.com/jfhbrook/node-ecstatic/issues/235#issuecomment-433590144
@imcuttle It's not "complex processing". It's simplification. 😄 . I saw your solution. It may work but that's a temporary solution as you said.
Forgive my thread necromancy!
My concern with this PR as it stands is that a lot of people use this module outside the context of ecstatic, where this flag is actually pretty useful.
Unfortunately I don't use express very often and certainly don't use this module with express! so I don't actually understand the desired behavior with express that well or why basedir breaks it. Is there a way to get this behavior without removing the baseDir option?
Something that might be helpful for me is breaking tests for the behavior in express - this would give me a spec to work against.
Good to see you back after months!
Actually I changed my mind after that. It's better to keep it not relying on a hosting framework as since it's born.
Thank you for taking care of this PR. Now you can close it.