作者: gamezz 时间: 2021-12-23 18:04 标题: 请问各位用开边套 nodejs orm
刚刚由 php codeigniter 转用 nodejs,
请问各位用开边套 orm? thanks.
https://github.com/typeorm/typeorm
https://github.com/sequelize/sequelize/
https://github.com/prisma/prisma
作者: gamezz 时间: 2022-1-14 16:42
大家写model时,会唔会将其他method写入model入面?
例如user - generate hash key
定系应该开多个 user service file?
作者: kennyleunghk 时间: 2022-1-14 17:27
除了mongoose 外嘅ORM好似都唔太值得使用
如果要用ORM嘅话我会直接springboot
如果你一定要用node.js 行backend 玩ORM, sequelize 应该系最好嘅选择啦
作者: superwebguys 时间: 2022-1-28 14:55
本帖最后由 superwebguys 于 2022-1-28 15:44 编辑
回覆 2# gamezz
网上有些example 把 password validation 放在user model 内:
- UsersSchema.methods.validatePassword = function(password) {
- const hash = crypto.pbkdf2Sync(password, this.salt, 10000, 512, 'sha512').toString('hex');
- return this.hash === hash;
- };
