diff --git a/aws-node-express-dynamodb-api/index.js b/aws-node-express-dynamodb-api/index.js index 369c67e1d..d50eaa3fa 100644 --- a/aws-node-express-dynamodb-api/index.js +++ b/aws-node-express-dynamodb-api/index.js @@ -43,9 +43,9 @@ app.get("/users/:userId", async function (req, res) { app.post("/users", async function (req, res) { const { userId, name } = req.body; if (typeof userId !== "string") { - res.status(400).json({ error: '"userId" must be a string' }); + return res.status(400).json({ error: '"userId" must be a string' }); } else if (typeof name !== "string") { - res.status(400).json({ error: '"name" must be a string' }); + return res.status(400).json({ error: '"name" must be a string' }); } const params = {