TypeScript decorators are a way to modify or extend the behavior of classes, methods, or properties in a declarative manner. They are denoted by the @ symbol and are applied using a syntax similar to annotations in other languages. Decorators are commonly used in TypeScript with frameworks like Angular, NestJS, and libraries like MobX. They provide a clean and modular way to enhance or alter the functionality of various elements within a TypeScript application. Decorators are a powerful tool for metaprogramming and can be employed to address concerns like logging, validation, and dependency injection. Enabling decorators in TypeScript Ensure “experimentalDecorators”:…

With NestJs you build NodeJS server-side applications, with direct support for Express (default) or Fastify under the hood, but NestJS can work with any Node HTTP framework once an adapter is created. Nest provides an out-of-the-box application architecture which comes along with a certain level of abstraction but NestJs also exposes the underlying APIs directly to the developer. Nest is compatible with both TypeScript and pure JavaScript. NestJs makes heavy use of decorators. Initializing a NestJS project The following commands will create a NestJs project folder with some core files: $ npm i -g @nestjs/cli $ nest new project-name –strict…

…”new”; false true get Accessor descriptor only. A function which serves as a getter for the property, or undefined if there is no getter. set Accessor descriptor only. A function which serves as a setter for the property, or undefined if there is no setter. If a descriptor has neither of value, writable, get and set keys, it is treated as a data descriptor. If a descriptor has both [value or writable] and [get or set] keys, an exception is thrown. More examples on the MDN website. Object descriptors in decorators Object descriptors play an important role in TypeScript decorators….

…your API Incoming queries are validated and executed against the schema A schema shows the relations between your data endpoints There are basically two common approaches on how to create a schema: You can either define it yourself by writing SDL manually (SDL-first approach) or you have it generated by classes that you annotated with decorators (code-first approach). Supported types are Scalar Object including root operation types: Query, Mutation, and Subscription Input Enum Union Interface Scalar types Scalar fields are fields that contain concrete data, they represent the leaves of the query. GraphQL comes with a set of default scalar…