4 ms·
I still am using express. Express 4 really solved some of the headaches of prior versions, and we have custom middleware we wrote and have good patterns for se
by davismwfl 11y ago
I still am using express. Express 4 really solved some of the headaches of prior versions, and we have custom middleware we wrote and have good patterns for separation of routes/controllers and views. So it works well for us, and the community is the largest so support and help is easy to find.
hapi is good but to me requires more forethought on the application and usage etc. Not a bad thing at all, but sometimes during rapid iteration this just isn't possible so then you wind up redoing larger chunks then you would with say express. For a team that has more time or is more mature in process it would be good. Although in all fairness I have not researched the updates to hapi in quite a while so this may be a bit stale.
koa I never considered seriously when we were starting our projects so I can't comment.
One other you should look at depending on your needs is restify. I haven't used it yet for a production application, but do have it wired up in a experiment right now.
*EDIT:
Also for user management, yes we rolled our own. There are npm modules like passport but we didn't like it before and haven't gone back to reevaluate since ours works good.
- tixocloud 11y agoThanks for sharing. How have you find the coding and debugging experience of server-side JS in general? I'm most familiar with Python and Java but wonder if server-side JS is going to cause me a headache trying to learn everything. The one thing that's slightly holding me back is the development time (i.e. more documentation and libraries for Python/Django means it's easier to figure out how to do stuff) For your own user management, do you have any reference material to share? I haven't been able to find many good articles on getting everything all set up.
- davismwfl 11y agoYour welcome. I love node, don't get me wrong there are frustrating parts to it like any language, but overall it has been super productive after you get past the learning curve. Coming from Python you will have little trouble, and the learning curve isn't too bad if you have a reasonable handle on javascript. For node there are a ton of libraries, code snippets and modules that are available, way more today than even just a few years ago. Searching npm is a good start and from there most people link directly to their code on github so you can see how things are done. As for debugging, I use Webstorm as an IDE and I can set breakpoints, walk thru code and do all the normal things you would in an IDE environment. I personally still use vim at times to when I am doing simple things and don't need to fire up the IDE, but all our node projects are in Webstorm just because it speeds up development. I also still dump a bunch of stuff to the console when I am debugging just because I am weird that way, plus in some cases I found it is faster than debugging code sections where timing can be different every run. Some learning curve issues. Remember node is event driven, code is not necessarily synchronous when you read it top down. Callbacks wind up getting deep and ugly if you aren't careful, generally IMO when I see too many callbacks nested it is either a place where promises should be used or even more likely it is a place that just is trying to do too much and screams for breaking steps up. There are some modules to familiarize yourself with too that you will use a lot, async immediately comes to mind in addition to the express series. As for our user module, no we haven't open sourced it or even written it up externally yet, but I think I might do one or both soon. Honestly passportjs is a great little module from all that I know, but when we started writing our systems we evaluated it and just didn't feel it fit what we were doing. Today that decision might be different if we had to start over. In general, our systems use MongoDB for the database, Mongoose for schema's and then we rolled our own authentication, utilities and errors. We use winston for logging as it works well and gives us a ton of flexibility. As part of our middleware too, we added methods to the request object to allow us to simply call our api backend, so we have an apiGet, apiPut, apiPost, apiDelete. These handle all the complexity of calling the API and remove a lot of headaches and in turn makes the code way easier to debug and far cleaner.
- tixocloud 11y agoThanks so much for all that input. I'm excited by using node but at a previous workplace, I've been through JS hell where everything becomes spaghetti so I am slightly more cautious about things. Debugging was a nightmare although it could probably be down to the fact that JS best practices weren't used. I'll check out passportjs for sure and evaluate whether or not I should roll my own thing but yes, the user module will be absolutely invaluable!