Created
March 7, 2022 14:22
-
-
Save evankirkiles/20f45fff99b090586a2ac7116914a455 to your computer and use it in GitHub Desktop.
MEDIUM: AWS Amplify Lambda Function Cascading Delete Serverless Express Route
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Clothe = require("./clothe.js"); | |
\\ ... | |
app.delete("/clothe/:clotheId", function (req, res) { | |
if (!req.headers["authorization"]) { | |
res.json({ success: false, error: "Not authenticated!" }); | |
} else if (!req.params.clotheId) { | |
res.json({ success: false, error: "No clothe ID parameter!" }); | |
} else { | |
Clothe.deleteCascading(req.params.clotheId, req.headers["authorization"]) | |
.then((collaterals) => { | |
res.json({ success: true, data: collaterals }); | |
}) | |
.catch((err) => { | |
console.log(err); | |
res.json({ success: false, error: err }); | |
}); | |
} | |
}); | |
\\ ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment