I’m using the body-parser package like this: When a valid input like { “foo”: “bar” } is received everything works fine and I can access the parsed object with req.body. However, when invalid (non-JSON) data is sent: I get this error: How can I handle this properly to prevent the server from shutting down? Answer One option is to add