如何在nodejs中创建mysql模式
问题描述:
我正在使用nodejs,为我的数据库表达框架和mysql。 我想知道如何使用mysql复制这个mongoose代码。我找不到在nodejs文件中写入我的sql模式的方法。我必须为此使用工作台吗?谢谢!如何在nodejs中创建mysql模式
var mongoose = require('mongoose');
var userSchema = mongoose.Schema({
local: {
username: String,
password: String
}
});
module.exports = mongoose.model('User', userSchema);
答
你可以使用任何的:
书架
knex
异议
ORM
sequelize
看到那间比较:
https://npmcompare.com/compare/bookshelf,knex,objection,orm,sequelize
本教程可能帮助您使用“sequelize”的: Creating a Role-Based User Authentication System with Angular, Express and MySQL
+0
该链接不起作用了 – Nmaster88
检查: http://blog.ragingflame.co.za/2014/7/21/using-nodejs-with-mysql – malyy
一件事我不明白:你为什么使用** Mongoose **?如果您输入[**猫鼬的网站**](http://mongoosejs.com/index.html)上面清清楚楚地写着: '猫鼬:为node.js' – charliebrownie
@charliebrownie优雅MongoDB的对象建模我是跟随教程系列他在哪里使用这个代码。但我更喜欢mysql,所以这就是为什么我正在寻找替代品。 –