# 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)에 있습니다.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jakekwak.gitbook.io/nestjs/recipes/untitled-9.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
