> For the complete documentation index, see [llms.txt](https://jakekwak.gitbook.io/nestjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jakekwak.gitbook.io/nestjs/recipes/untitled-9.md).

# Serve Static

## Serve Static

SPA (Single Page Application)와 같은 정적 컨텐츠를 제공하기 위해 `@nestjs/serve-static` 패키지의 `ServeStaticModule`을 사용할 수 있습니다.

## Installation

먼저 필요한 패키지를 설치해야합니다:

```bash
$ npm install --save @nestjs/serve-static
```

## Bootstrap

설치 프로세스가 완료되면 `ServeStaticModule`을 루트 `AppModule`로 가져 와서 구성 객체를 `forRoot()`메소드에 전달하여 구성할 수 있습니다.

```typescript
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { ServeStaticModule } from '@nestjs/serve-static';
import { join } from 'path';

@Module({
  imports: [
    ServeStaticModule.forRoot({
      rootPath: join(__dirname, '..', 'client'),
    }),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
```

이를 사용하여 정적 웹 사이트를 빌드하고 해당 컨텐츠를 `rootPath` 특성으로 지정된 위치에 배치하십시오.

## Summary

실제 예제는 [여기](https://github.com/nestjs/nest/tree/master/sample/24-serve-static)에 있습니다.
