Skip to content

Instantly share code, notes, and snippets.

View aryamohanan's full-sized avatar
👀

Arya aryamohanan

👀
View GitHub Profile

Interview Questions

Node.js

Q1: What do you mean by Asynchronous API? ☆☆

Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Source: tutorialspoint.com

Controller
Uses a single UseCase class
Controllers should have no business logic, their reason to exist is to control access and provide a view of the result
These are classes that provide/handle access and call a single useCase class. Transform the result of the useCase into the appropriate View that could be selected by the caller in some cases. The transformation of the result is not the responsibility of the controller, any transformation should happen in a ViewClass. Translate any business errors into user friendly results. They don't log, they don't "try, catch", they don't calculate.
UseCase class
Uses injected Services
This class doesn't interact with clients directly, it should only use services. It handles all errors on this layer and lower layers. It doesn't know how to do anything but it knows what needs to be done.