REST Create Endpoint Status Code
Spot the incorrect HTTP status code returned when creating a new resource.
Codejavascript
const express = require('express');
const app = express();
app.use(express.json());
let users = [];
// Create a new user
app.post('/users', (req, res) => {
const user = { id: users.length + 1, name: req.body.name };
users.push(user);
res.status(200).json(user);
});
app.listen(3000);What is the bug in this resource-creation endpoint?