S SmartDocs
系列: nest.js typescript 13 行 · 更新于 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`;
  }
}

相关文章