Hi, thanks for sharing! I was not aware that express ships with bodyParser now, I have to give this a try. In regards to named imports, it does make the code more concise. But I think it may be a tad confusing to have a function named json.
Father of four under four, three boys and one girl! Full-Stack dev programming mostly in Javascript/TypeScript these days, with a decent amount of Rust on the side
At first I thought it would be weird too, but I've found that only using it on routes that actually need to parse json actually doesn't look so bad. For example
Hi, thanks for sharing! I was not aware that express ships with bodyParser now, I have to give this a try. In regards to named imports, it does make the code more concise. But I think it may be a tad confusing to have a function named json.
At first I thought it would be weird too, but I've found that only using it on routes that actually need to parse json actually doesn't look so bad. For example
It might still be better to just use
express.json
or to rename it to something likejsonMiddleware
though