garris / garris/superSimpleExpressServer
Fixes `path.resolve(false)` in `MIDDLEWARE_PATH` declaration.
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used [patch-package](https://github.com/ds300/patch-package) to patch `super-simple-web-server@1.1.4` for the project I'm working on.
While debugging `backstop remote` I came across an issue with the middleware arg here. `path.resolve` doesn't accept booleans, so this splits the declaration of `MIDDLEWARE_PATH` into a ternary instead.
Hope this helps. Thanks for all you do!
Here is the diff that solved my problem:
```diff
diff --git a/node_modules/super-simple-web-server/index.js b/node_modules/super-simple-web-server/index.js
index 1eb8065..a27c9b9 100644
--- a/node_modules/super-simple-web-server/index.js
+++ b/node_modules/super-simple-web-server/index.js
@@ -34,7 +34,7 @@ function logger(req, res, next) {
* To add middleware set the third arg to a path that resolves to a file exporting a function like so...
* module.exports = (app) => { app.use(someCoolThingHere);}
*/
-const MIDDLEWARE_PATH = path.resolve(process.argv[3] || false);
+const MIDDLEWARE_PATH = process.argv[3] ? path.resolve(process.argv[3]) : false;
if (MIDDLEWARE_PATH) {
try {
var initMiddleware = require(MIDDLEWARE_PATH);
```
This issue body was [partially generated by patch-package](https://github.com/ds300/patch-package/issues/296).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.