There is no absolute need for an ORM. You can install the mysql driver for node.js through npm and include it in your project.
The documentation can be found here: https://www.npmjs.com/package/mysql
You could implement it like this:
var sql = require('mssql');
var config = {
user: "databaseAccountUsername",
password: "databaseAccountPassword",
server: "databaseServerAddress",
database: "databaseName",
options: {
encrypt: false
}
}
const pool = new sql.ConnectionPool(config);
pool.connect(err => {
if(err) {
console.log(err)
}
});
function getCustomers() {
var request = new sql.Request(pool);
request.query("SELECT customer_id, first_name FROM customers")
.then((result) => {
res.end(JSON.stringify(result.recordsets[0]));
})
sql.close();
}
I suggest making your queries in your routes and handling them with express or any other request/response library