Skip to content

Instantly share code, notes, and snippets.

@evankirkiles
Created March 7, 2022 14:22
Show Gist options
  • Save evankirkiles/20f45fff99b090586a2ac7116914a455 to your computer and use it in GitHub Desktop.
Save evankirkiles/20f45fff99b090586a2ac7116914a455 to your computer and use it in GitHub Desktop.
MEDIUM: AWS Amplify Lambda Function Cascading Delete Serverless Express Route
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