nut-swagger npm package is a light-weight and flexible library to generate Node.js controller modules from swagger definition file. The controller modules generated by this npm package is also used by nut-ioc
nut-pipe npm package is an implementation of Chain of Responsibility Pattern. We can encapsulate or wrap every aspect of code in separate module or class or function, etc. So that, separated aspect modules would implement Single Responsibility Principle(SRP) and Seperation of Concern Principle(SoC) properly.
🙂 so if you want to implement OOP basics and principles, then you can use nut.pipe npm package.
This design provides to developer clean business logic code. They don't need to think about Error, Exception, Log handling business logic. Before their business logic code is called, pipeline is called and it means first middleware is triggered then first middleware will trigger next one, but no middleware knows about next middleware. Middleware should know about its business logic then should call next one.
I know too much words but developers want to see code 🙂 same code will be developed in different ways.
Code example v1
I wrote a greeting service with sayHello() and sayGoodbye() functions. They include all business logic in their body. This is not good approach definitely. Code duplications are everywhere 🙂 For example, every functions have try/catch, console.log('ENTRY: …'), console.log('SUCCESS: …'), console.log('ERROR: …'), etc. Notice that getFullName doesn't contain these business logics. So, we can't know whether it is called or not. If developer like me 🙂 doesn't write these kind of aspects(logging and exception handling is kind of aspect) then we never understand that that method is called in run-time.
I just want to see my micro services in a tree view. This is a configurable and flexible D3 Node.js project. In order to achieve this project, I have used D3, Node.js and Parcel (https://parceljs.org). I hope that some one will benefit from this project like me 🙂