As I created applications with Express and Node, I learned about three useful middlewares:
Morgan
Camelcase
Remove empty properties
Of these th...
For further actions, you may consider blocking this person and/or reporting abuse
Hi, I don't understand why you create the high order function like this
const removeEmptyProperties = () => {
return function(req, res, next) {
req.body = omitEmpty(req.body);
req.params = omitEmpty(req.params);
req.query = omitEmpty(req.query);
next();
};
};
and use it like this
app.use(removeEmptyProperties());
Isn't creating the function like this
const removeEmptyProperties = (req, res, next) => {
req.body = omitEmpty(req.body);
req.params = omitEmpty(req.params);
req.query = omitEmpty(req.query);
next();
};
and using it like this
app.use(removeEmptyProperties);
enough?
Thanks for this write up. As a dev that's new to Node & Express, having a package like Morgan that provides me some details about the requests hitting my routes is fantastic. Plus it will reduces the amount of console.log() statements I'd have to write. ππ½
Hi, I'm wondering how is the impact of these to your app performance?
this is so much useful! thank you! ππ
Perfect! Feels like I just discovered a hidden gem.
Downloading these as soon as I get back to a computer. Thanks for sharing Zell!
Super useful middleware(s) π―