What is Context in NestJs

Viewed 451

I'm new to nestjs, I'm studying nestjs from its documentation.

I see the word context a lot in the documentation. For example:

Execution Context
Application Context 
Http Context

I want to know what "Context" means.

Any help would be appreciated.

1 Answers

As per the official documentation regarding Execution context:

Nest provides several utility classes that help make it easy to write applications that function across multiple application contexts (e.g., Nest HTTP server-based, microservices and WebSockets application contexts). These utilities provide information about the current execution context which can be used to build generic guards, filters, and interceptors that can work across a broad set of controllers, methods, and execution contexts.

If I translate properly, in NestJS, the context corresponds to the way you mount your NestJS application; like HTTP, RPC for microservices, WebSocket, but could also be just a standalone app (i.e. without any network listeners).

Related