Simple as express, powerful as Chuka!
Hello everyone!
I am going to introduce you to Chuka, a new library which tends to make the backend development easier and keep the code maintainable. It is built on top of ExpressJS, so simple to learn though able to tackle technical challenges through simple and reasonable approaches.
In brief, it has three main advantages, dependency injection, strongly typed with typescript, and powerful validation. Additionally, a fast learning curve with whom they are familiar with express-like libraries.
I introduce it by applying the library for a simple list-of-cats program.
The first snippet features how we can introduce both dependencies and routes together and gives an overview of the running application to the programmer.
The second snippet depicts the use of applying middlewares, using dependencies and creating a completely custom validation mechanism.
Applying the Validators and Middlewares will cause the handlers to be helped with strong types.
In the above picture, the body has intellisense because the body of the request object was validated with a middleware before!
Even more!
You can validate anything that is being passed through the request, such as session, cookies, query, etc.
You have dependency injection and it helps your controllers access the outside world through loosely coupled dependencies which gives you the ability to test your application easily and evade being dependent upon implementation details.
At last...
It is just a try to make the application development easier for our community! let's make it better and please let me know your ideas and suggestions of how it will be a better tool for our benefit.
Senior Angular Developer | React.js | Nest.js | .Net Core | Blazor | Blockchain Smart Contract
1 年Good, try nest.js also.