Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 1.09 KB

service-providers.md

File metadata and controls

53 lines (36 loc) · 1.09 KB

Service Providers

Introduction

tba.

Creating Service Providers

All service providers should extends the ServiceProvider class provided by @supercharge/support. The main methods you can implement in your service provider are register and boot:

import { ServiceProvider } from '@supercharge/support'
import { MarkdownRenderer } from './markdown-renderer'

export class MarkdownServiceProvider extends ServiceProvider {
  /**
   * Register application services to the container.
    */
  override register (): void {
    this.app().singleton(MarkdownRenderer, () => {
      return new MarkdownRenderer(this.app())
    })
  }

  /**
   * Boot application services.
   */
  override async boot (): Promise<void> {
    await this.app().make(MarkdownRenderer).boot()
  }
}

The Register Method

tba.

The Boot Method

tba.

Registering Providers

tba.