![]() |
| source: https://scotch.io/wp-content/uploads/2014/04/restful-api-node-express-4-router.jpg |
removeUserById: function (id, cb) {
User
.destroy({where: {id: id}})
.then(function (number) {
return number ? cb(null, true) : cb(null, false);
})
.catch(function (error) {
return cb(error);
});
}
Bây giờ, chúng ta sẽ thêm một router mới đảm nhận vai trò xóa user theo email được cung cấp. Chỉnh sửa tập tin user.js trong thư mục app/controllers theo nội dung như bên dưới:

