Tmirun blog

  • Home

  • Archives

Sequelize 那些事

Posted on 2017-09-22 | Edited on 2018-10-17 | In Node

some description

不返回 password

直接覆盖 toJSON 方法.

1
2
3
4
5
6
7
8
9
sequelize.define('user', attributes, {
instanceMethods: {
toJSON: function () {
var values = Object.assign({}, this.get());
delete values.password;
return values;
}
}
});

参考: stackoverflow

# Node
Javascript 内部沟通方法
Javascript 项目那些事
  • Table of Contents
  • Overview

Tmirun

39 posts
17 categories
34 tags
  1. 1. 不返回 password
© 2019 Tmirun
Powered by Hexo v3.8.0
|
Theme – NexT.Muse v6.5.0