Tuesday, 21 January 2020

Considering hapi.js and nest.js as engine for the next work project

I work with node.js since the early 2011 and from that day I been using connect/express.The javascript world has evolved a lot, and nowadays I am a great fan of Typescript, due to that, the latest backend project I had to develop was written with Koa, as it had a decent support for async/await and TSThe previous one was a small project, and the current, next one, will also be, but I would like to add some challenge/opportunity to try another framework, to check if I have been missing out something better.I will lay down my opinion of what I have read so far, feel free to correct me or add your expertise.Nest.js:- Built with angular DIThat's a good thing generally, but putting the "Angular" word also could mean convoluted logic/syntax- Typescript, heavy on decoratorsGood in my book, just a small step to write customised decorator in case it's needed- GraphQL, Websockets, Microservices optional packagesWon't use those, but nice-to-have in other projects- Express.js underlying engineI would consider that as a drawback! Given the stale development and status of the project, I would rather not have it and move on- Heavy on class-based code and inheritanceThat's a personal preference, but being a long-standing javascript programmer I would rather have a more functional approach​Hapi.js:- Good typescript support in recent versions- Very famous HTTP validator, JoiI am quite fond of that library, it's the one that let me discover hapi.js in the first place- Hapi Router engineHappy to not use express, although when I seen how to compose Hapi routers it seems a bit convoluted, I might be wrong.- More agnostic than Nest.jsDo you want to use it for microservices, graphql, or websockets? Hapi doesn't care, roll your own, or else! I kind of like that approach, but I also see it can be a drawback not have an already paved street- Older project, more stableThere is no comparison on that, Hapi is comparable to express.js as the project start date, so for a number of reasons it should be more documented or known

Submitted January 21, 2020 at 10:55AM by colthreepv

No comments:

Post a Comment