How to create mysql schema in nodejs

I am using nodejs, express framework and mysql for my database. I would like to know how I can replicate this mongoose code using mysql. I cannot find a way to write my sql schema in a nodejs file. Should I use a workbench for this? Thanks!

var mongoose = require('mongoose'); var userSchema = mongoose.Schema({ local: { username: String, password: String } }); module.exports = mongoose.model('User', userSchema); 
+5
source share
1 answer

You can use any of:
bookshelves
knex
objection orm
sequelize

see comparison between this:

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

This tutorial can help you use sequelize: Creating a Role-Based Authentication System Using Angular, Express, and MySQL

+1
source

Source: https://habr.com/ru/post/1237237/


All Articles