app.post("/properties", async (req, res, next) => { try { const { body } = req; const property = new PropertyModel(body); await property.save(); return res.status(201).send(formatProperty(property)); } catch (error) { if (error.name === "ValidationError") { error.status = 400; } next(error); } });