News for hackers. Stuff that matters.
Re:Node.js Examples – How Enterprises Use Node in 2016 by olalonde on Tuesday June 14, 2016 @12:02PM (#11902903)
As someone who has been writing core APIs in Node.js for a few years now, one thing I really miss is a good ORM. The best one is probably Bookshelf.js but it's poorly maintained and lags behind more mature ORMs like Active Record in terms of features and stability.
Re:Node.js Examples – How Enterprises Use Node in 2016 by Keepo on Tuesday June 14, 2016 @12:42PM (#11903241)
You might want to check this https://github.com/Vincit/objection.js it is the only node ORM I don't hate yes even compared to sequelize I tried them all.
Re:Node.js Examples – How Enterprises Use Node in 2016 by ht85 on Tuesday June 14, 2016 @12:16PM (#11903040)
I used bookshelves a couple years ago and while it was very good on paper, I quickly ran into a lot of quirks and bugs for advanced usage.

There was an obvious lack of resources to develop it, and after contributing to it a bit I switched. Reliability is the #1 feature in an ORM in my opinion, and I didn't get that confidence from using bookshelves.

I later moved to sequelize, and it worked flawlessly from the get go, give it a try. You can compare the Github activity, you'll see it's thriving, and everything is much cleaner.

The performance is also way ahead, as last time I used it bookshelves relied on Backbone-esque models underneath, making it way slower for big nested queries.

Re:Node.js Examples – How Enterprises Use Node in 2016 by olalonde on Tuesday June 14, 2016 @12:25PM (#11903120)
Thanks. I actually started out with Sequelize before switching to Bookshelf.js but you convinced me to give it another go.
Re:Node.js Examples – How Enterprises Use Node in 2016 by gaastonsr on Tuesday June 14, 2016 @01:12PM (#11903489)
Noo, give it a go Bookshelf.js you will be more happy. Yes, maintenance lacks behind sometimes but the core is strong.

And if you do anything particularly hard you always can tap into knex and get all its powerful API and if that is not enough you run raw queries until the feature is officially supported.

Re:Node.js Examples – How Enterprises Use Node in 2016 by z3t4 on Tuesday June 14, 2016 @03:48PM (#11904781)
Writing asynchronous SQL queries is tedious indeed. SQL is very powerful though, and has it's use cases. But for real time applications, like multi-player servers, it doesn't really fit, so for those use-cases, I've made an ORM (1) that use proxies so data can be treated just like any JavaScript object, with synchronous in memory read/write and asynchronous HDD persistence via an SQL server.

1) https://github.com/Z3TA/dbo

Re:Node.js Examples – How Enterprises Use Node in 2016 by overcast on Tuesday June 14, 2016 @12:18PM (#11903061)
If you're using RethinkDB, https://thinky.io works well. I use it for all my current projects.
Re:Node.js Examples – How Enterprises Use Node in 2016 by ruddct on Tuesday June 14, 2016 @12:07PM (#11902948)
Not to go too off-topic, but Sequelize is worth a look if you haven't played with it already.
Re:Node.js Examples – How Enterprises Use Node in 2016 by casenjo on Tuesday June 14, 2016 @07:03PM (#11906064)
I recently started playing around with Node for a friend's side project. I helped him set up the database and Sequelize was absolutely horrible to get up and running. The documentation was really lacking and we spent hours trying to track down little details needed to get things running. It does the job once you have it set up, but I found getting to that point was way more difficult that it should have been.
Re:Node.js Examples – How Enterprises Use Node in 2016 by olalonde on Tuesday June 14, 2016 @12:20PM (#11903080)
I used Sequelize for a while before Bookshelf was released and haven't used it since so I'm not sure how it compares these days. One thing I like about Bookshelf is that the query builder (Knex.js) is fairly decoupled and it's not that scary to drop down to the SQL layer. I still feel it's not quite as good as it could be.
Re:Node.js Examples – How Enterprises Use Node in 2016 by gaastonsr on Tuesday June 14, 2016 @01:14PM (#11903519)
This might not be objective because I hate sequelize but sequelize sucks! I never understood its API. Is so clunky compared to Bookshelf.js.

Bookshelf is less opinionated on the way you integrate it with your web app with makes it good to work with if you have strong opinions on how it should integrate with your codebase.