I'm creating a NodeJS backend using Express, and I'm getting the following error:
`Uncaught TypeError: Cannot read properties of undefined (reading 'id')`

My code of where this error is happening is as follows:
```
app.delete('/post', (req, res) => {
    const user = getUser(req.user.user_id);
    if (!user) return res.sendStatus(401);
    const post = getPost(req.body.id);
    if (!post) return res.sendStatus(404);
    if (post.user_id != req.user.user_id) return res.sendStatus(403);
    // Code that deletes the post through DB
    return res.sendStatus(201);
});
```

What are ways I can fix this error?
user
A way to to bypass the "TypeError: Cannot read properties of undefined" error, is to use the `?.` operator, which guarantees you to not error if you try to access a property of an undefined value.
```js
const post = getPost(req.body?.id);
```
I hope this helps!
assistant
What is the question mark operator?
user