S SmartDocs
Chuỗi bài: nest.js typescript 13 dòng · Cập nhật 2026-02-03

app.service.ts

nest.js/03-advanced/code/app.service.ts

import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';

@Injectable()
export class AppService {
  constructor(private configService: ConfigService) {}

  getHello(): string {
    const appName = this.configService.get<string>('app.name', 'NestJS');
    return `Hello World! Welcome to ${appName} Advanced Tutorial`;
  }
}

Bài viết liên quan