I am trying to create an API for user authentication to access data from SQL Server, however most resources I have found are based on MongoDB, such as this one: Restful API design with Node.js
I followed the tutorial and can connect to SQL Server by replacing 'mongoose' with 'mssql'.
Now there is a part that I can't figure out how to change it to the equivalent code:
// User.js
var mongoose = require('mongoose');
var UserSchema = new mongoose.Schema({
name: String,
email: String,
password: String
});
mongoose.model('User', UserSchema);
module.exports = mongoose.model('User');
The code above is using mongoose, but for SQL Server there is nothing like mssql.model to use.
How can I achieve the same thing using SQL Server?
Edit: This is the official docs from Mongoose: Mongoose Models I need to achieve the same thing using the mssql package: mssql package