I'm on the look for an ORM mapper for SQL Server on Node.js. Long story short, we have a SQL Server running and now we want to use node.js to build web services pulling data from the database.
Do you know any ORM that supports SQL Server on Node.js?
I know that there is this tedious which can help connect to SQL Server but it does not have ORM.
Thanks
SQL Server so far hasn't gotten a great deal of support yet in the Node.js community. And, since most of the Node.js ecosystem is community-driven, your options will likely be rather limited.
That's not to say there aren't plans to add support for it; just that not many have achieved it yet. Example: The author of sequelize has stated intent to add support eventually.
For now, if it's enough to get plain Objects with columns as keys, Microsoft's own msnodesql can be a good option with its query() method:
sql.query(conn_str, "SELECT 1 as X, 'ABC', 0x0123456789abcdef ", function (err, results) {
assert.ifError(err);
var buffer = new Buffer('0123456789abcdef', 'hex');
var expected = [{ 'X': 1, 'Column1': 'ABC', 'Column2': buffer}];
assert.deepEqual(results, expected, "Results don't match");
done();
});
I like Node-odbc, I think some kind of ODBC abstraction is probably best all RDBMS' with NodeJS
According to sequelize's documentation, orm support for sql-server is available in version 2.0 (released on Feb. 10, 2015, previously added on Dec. 22, 2014's release candidate).
Have a look at mssql-orm. It supports writing large object graphs to SQL Server, but has a very lightweight API:
var person = db.model({table: 'people'});
var bob = person({
name: 'bob'
});
bob.save();