Comments (7)
Do not do app.use(mung);
It is not correct.
mung
is middleware for middleware. As the readme illustrates you should have your middleware, such as redact
call mung
.
You have not shown your redact.js
, so I can't provide much more help. If you post your code, or even easier just point me to the github repo, I can then provide more details.
Thanks for trying the package.
from express-mung.
OK, I made a github repo here. You can run the app with npm start
The files in focus are app.js and nulljson.js
app.js
line 28 as [1]
line 66 as [2]
nulljson.js
line 12 as [3]
At current state of the repo [2] has been commented and the app is working fine. You can make request at:
- http://localhost:3000/api/cinema/0001 < found data
- http://localhost:3000/api/cinema/0003 < not found data; response is {} (modified response success)
If I comment [3] which I no longer want to modify the body
- http://localhost:3000/api/cinema/0001 < found data
- http://localhost:3000/api/cinema/0003 < NOT RESPONDING
Then if I comment [1] and uncomment [2](which [3] is still commented)
- http://localhost:3000/api/cinema/0001 < found data
- http://localhost:3000/api/cinema/0003 < not found data; response is null, no console output 'nulljson'
The problem is when I comment [3] why the app does not respond?
Thanks
from express-mung.
Another little side note in your usage example
exports = mung.json(redact);
It have to be?
module.exports = mung.json(redact);
from express-mung.
exports
and module.exports
is allowed by node; see stack overflow
from express-mung.
The pull request gets express-mung
and nulljson
working.
Basically
- don't require/use
express-mung
in app.js - do use
nulljson
in app.js
from express-mung.
24 hours have passed, I assume you are happy with the solution, so I'm closing the issue. But feel free to post a comment and I'll re-open the issue.
Good luck with your app.
from express-mung.
Yes, your solution works perfectly. I comment this just to comfirm that. Sorry for late checking the issue.
Thank you for your help.
from express-mung.
Related Issues (20)
- mung.json vs scalar value
- Add a 'before' munging function HOT 5
- Support text processing HOT 1
- Feature request: `mung.write` HOT 6
- problem in frontend unit tests HOT 1
- res.send during a mung
- When using res.json(Number) you get server error HOT 3
- Using express-mung to modify static folder doesn't seem to work HOT 2
- Middleware not being called when on static files HOT 3
- On mung.write, chrome throws ERR_CONTENT_LENGTH_MISMATCH 200 (OK) HOT 4
- mung.onError assumes json HOT 1
- Connecting request and response data into single object HOT 4
- publish new version of module HOT 2
- express-mung does not work in Prod environment
- Doesn't not intercept res.status different that 200 HOT 1
- ReferenceError: Cannot access 'args' before initialization in headersAsync HOT 1
- OnError Issue HOT 1
- res.status() and mung.json() HOT 8
- Munging errors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from express-mung.