CRUD Operations using Node JS.
The CRUD
CRUD stands for Create, Read, Update, and Delete. These are the four basic operations that are necessary for any database application. In such apps, users must be able to create data, have access to the data in the UI by reading the data, up...
js-love.hashnode.dev4 min read
Narayana M V L
Talks About Coding
Nice Explanation Adhi, Just want to Add support for custom where clauses:
async destroy(data, whereClause = {}) { const response = await this.model.destroy({ where: { id: data, ...whereClause, }, }); if (!response) { throw new AppError('Not able to find the resource', StatusCodes.NOT_FOUND); } return response; }
This allows users to specify additional conditions for deletion besides the primary key.