🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

auto-injectable-test

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

auto-injectable-test

Enables seamless DI within the Nest Framework.

unpublished
latest
npmnpm
Version
0.0.1-beta.0
Version published
Maintainers
1
Created
Source

tiny-nestjs

npm version License

Description

AutoInjectable is a utility library designed to simplify the usage of dependency injection in Nest. It enables seamless handling of automatic injection of dependencies by the framework.

Features

  • @AutoInjectable() decorator allows classes to be automatically injectable for DI.
  • @ComponentScan() decorator enables automatic scanning and injection of classes within a module.

Installation

npm install @tiny-nestjs/auto-injectable

Usage

1. @ComponentScan()

Use @ComponentScan() decorator to enable automatic scanning and injection of classes within a module:

```
import { Module } from '@nestjs/common';
import { AppService } from './app.service';
import { AppController } from './app.controller';
import { ComponentScan } from '@nestjs/auto-injectable';

@ComponentScan()
@Module({
  imports: [],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
```

By applying the @ComponentScan() decorator to the AppModule class, Nest will automatically scan for classes and inject necessary dependencies.

2. @AutoInjectable()

Use @AutoInjectable() decorator to make a class injectable for DI:

```
import { AutoInjectable } from '@nestjs/auto-injectable';

@AutoInjectable()
export class CatService {
    // ...
}
```

On this case, by applying @AutoInjectable() decorator to the CatService class, the class can now be automatically injected into other modules.

Contribution

To contribute to this library, fork the GitHub repository, make your changes, and create a pull request. Your contributions are highly appreciated. If you find any improvements or bugs, please open an issue.

License

@tiny-nestjs/auto-injectable is distributed under the MIT license.

Keywords

nest

FAQs

Package last updated on 06 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts