13

我正在为我的数据库使用 nodejs、express 框架和 mysql。我想知道如何使用 mysql 复制这个猫鼬代码。我找不到在 nodejs 文件中编写我的 sql 模式的方法。我必须为此使用工作台吗?谢谢!

var mongoose = require('mongoose');

var userSchema = mongoose.Schema({
    local: {
            username: String,
            password: String
         }
 });

module.exports = mongoose.model('User', userSchema);
4

1 回答 1

6

您可以使用以下任何一种:
bookshelf
knex
objection
orm
sequelize

看看这之间的比较:

https://npmcompare.com/compare/bookshelf,knex,objection,orm,sequelize

本教程可能会帮助您使用“sequelize”: Creating a Role-Based User Authentication System with Angular, Express and MySQL

于 2017-09-15T19:13:11.040 回答