Node/Nest Flashcards

1
Q

What is NestJS, and why is it popular for building Node.js applications?

A

NestJS is a framework for building efficient, reliable and scalable server-side applications. It is built on top of Node.js and is written in TypeScript. It makes a strong using of decorators for succint code and maintenance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Key features of Nest.js?

A
  • Modular Structure: NestJS promotes a modular structure, helping to organize code in a clear and maintainable way.
  • Dependency Injection: It has a robust Dependency Injection container that promotes code modularity and testability.
  • Decorators: NestJS utilizes decorators for adding metadata and additional behavior to classes, methods, and properties.
  • Middleware, Guards, Interceptors, and Pipes: These classes help to handle different aspects of the request-response cycle.
  • Microservices Support: NestJS has built-in support for microservice architecture.
  • Integration with Other Libraries: It provides a level of abstraction over libraries like Express or Fastify, making integration easier.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Difference between Express.js and Nest.js?

A
  • Express.js is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. On the other hand, NestJS is a more opinionated framework that provides a high-level abstraction with a lot of built-in decorators and modules.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does NestJS promote the use of TypeScript in Node.js development?

A

NestJS is built with TypeScript and encourages its use for building backend applications. It takes advantage of TypeScript’s strong typing and modern ES/TS features to reduce bugs and improve the quality of code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe the architecture pattern used by NestJS. What are the benefits of this pattern?

A

NestJS utilizes a Monolithic architecture with a modular design inspired by Angular. The architecture promotes a modular structure, dependency injection, and the separation of concerns between controllers and providers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain What is NPM ?

A

NPM-Node Package Manager is a package manager for the JavaScript programming language maintained by NPM, Inc.js.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Explain Modules in Node Js ?

A

Module in Node JS is a simple or complex functionality organized in single or multiple JavaScript files which can be reused throughout the Node JS application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are CommonJs Modules ?

A

CommonJS module is a reusable piece of JavaScript that exports specific objects made available to any dependent code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Is Node Js Single-threaded ?

A

Node JS is single-threaded similar to JavaScript. So, the JS code is running in a single thread(main thread) in consensus with the event loop and callback queue.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explain event loop in Node Js ?

A

The event loop is what allows Node JS to perform non-blocking I/O operations — despite the fact that JavaScript is single-threaded — by offloading operations to the system kernel whenever possible. Since most modern kernels are multi-threaded, they can handle multiple operations executing in the background.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly