Menu
Applo - Outer space server framework for Node.jsApplo - Outer space server framework for Node.jsAppolo
DocsExamplesGitHub
🌜
🌞
Applo - Outer space server framework for Node.jsApplo - Outer space server framework for Node.jsAppolo
  • Docs
  • Examples
  • GitHub
  • Overview
    • Introduction
    • Architecture
    • Getting Started
    • Benchmarks
    • Examples
  • Configuration
    • Options
    • Directory Structure
    • Environments
    • Middlewares
    • Modules
  • Route
    • Controllers
    • Actions
    • Routes
    • Middlewares
    • Hooks
    • Errors
    • IRequest
    • IResponse
  • Engine
    • Modules
    • Pipelines
    • Guards
    • Interceptors
    • Pipes
    • Exceptions
    • Bootstrap
  • Modules
    • Logger
    • View
    • Validator
    • Cache
    • Bus
    • Context
    • Http
    • Mongo
    • Redis
    • Socket
    • TypeORM
    • PubSub
    • Queue
    • Cqrs
    • Thread
    • GraphQL
    • Crud
    • State
    • Passport
  • Inject
    • Dependency Injection
    • Injector
    • Define
    • Inject Constructor
    • Inject Property
    • Singleton
    • Alias
    • Initialization
    • Factory
    • Lazy
  • Core
    • Create
    • App
    • Tree
    • Module
    • Route
    • Discovery
    • Events
  • Utils
    • Event Dispatcher
    • Helpers

Singleton

The class instance will be created only once and injector will return the same instance every time.

@define()
@singleton()
export class FooController{}
let fooController = injector.get<FooController>(FooController);
let fooController2 = injector.get<FooController>('fooController');
console.log(fooController === fooController2) // true
Edit this page
Previous
« Inject Property
Next
Alias »

Docs

  • Introduction
  • Getting Started

Guides & Tutorials

  • Examples & Use Cases
  • Configuration
  • Routes
  • Modules
  • Inject

More

  • GitHub
  • Deploys by Netlify
appolo Logo
Copyright © 2021 Appolo