Skip to content

Instantly share code, notes, and snippets.

@tamunoibi
Last active April 14, 2019 12:49
Show Gist options
  • Select an option

  • Save tamunoibi/df635bc5d13d7d2b235e11f3798114af to your computer and use it in GitHub Desktop.

Select an option

Save tamunoibi/df635bc5d13d7d2b235e11f3798114af to your computer and use it in GitHub Desktop.
@account @delete
//Deleting
const { accountId } = req.params;
const account = accounts.find(singleAccount => singleAccount.accountId === accountId);
// Handle cases where account with such an accountId is not found
if (!account) {
return res.status(400).json({
status: 'error',
message: 'No account with the given email',
});
}
// Handle cases where the account is in existence
user.remove({ accountNumber } ); // Confirm this part, remove() is not a function
return res.status(204).json({
status: 'success',
account,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment