DEV Community

Discussion on: RESTful API design with Node.js

Collapse
 
viki53 profile image
Corentin H. ⚡

This is great for beginners, but if you want to create a more robust API, you might as well use a framework. Especially if you're considering using Angular as a front-end.

I've used (and contributed to) LoopBack (2 and 3) for a while and it's pretty solid (and built on top of Express by the same guys who created it, so quite a bonus). Plus it manages users and permissions out of the box and there are tools to generate services (and models) for Angular. 😉

I did try Sails a while ago but it didn't go so well, as it was lacking compared to LoopBack.

Collapse
 
adnanrahic profile image
Adnan Rahić

I'd strongly disagree. I've been on the receiving end of a horrible relationship with Sails myself. Never would I want to advise someone to go down that path. Express is incredibly easy to work with, and very flexible. It's already a full-fledged framework. Any more abstraction above it is just overhead, mainly for performance and the cleanliness of your code. Integrating users, permissions and policies is much easier than it sounds. :)

This is just my humble opinion. But, I haven't tried LoopBack yet. Maybe after I do, I'll change my standpoint.

I'm glad you liked the tutorial. Cheers man! :)

Collapse
 
viki53 profile image
Corentin H. ⚡

I haven't explored Sails enough to know what you're talking about but it might be possible form what I remember. :)

LoopBack does bring a few things that you'd have to manage yourself with Express + Mongoose, like sending the right error codes to the client, modular type checking and multiple datasources (files, MongoDB, MySQL, etc.).

There's actually not that much overhead compared to Express (though it might seem like it at first), and it comes from the same team so it's pretty well integrated and you can still use Express if you need it.

Mongoose is also very strict sometimes and that can lead to some headaches. For APIs, it might sometimes be easier to have a more permissive checking (LoopBack has different settings, so you can adjust that).

Anyway, just sharing a tool, not trying to force anyone to convert to any religion. 🙏