You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
이렇게 하면 동적 라우트와 일치하는 모든 요청에 응답합니다. 예를 들어 `/helmet.json`으로 이동하면 `params.id`는 `helmet`으로 설정됩니다. `helmet`이 모의 제품 데이터베이스에 존재하면 엔드포인트는 `Response` 객체를 사용하여 JSON으로 응답하고 성공적인 [HTTP 상태 코드](https://developer.mozilla.org/en-US/docs/Web/API/Response/status)를 반환합니다. 그렇지 않으면 `Response` 객체를 사용하여 `404`로 응답합니다.
139
140
140
141
SSR 모드에서는 특정 공급자가 이미지를 반환하기 위해 `Content-Type` 헤더를 요구합니다. 이 경우 `Response` 객체를 사용하여 `headers` 속성을 지정합니다. 예를 들어 바이너리 `.png` 이미지를 생성하려면 다음을 수행합니다.
141
142
142
143
```ts title="src/pages/astro-logo.png.ts"
143
-
exportasyncfunction GET({ params, request }) {
144
+
importtype { APIRoute } from"astro";
145
+
146
+
exportconst GET = (async ({ params, request }) => {
SSR 모드에서 `request` 속성은 현재 요청을 참조하는 완전히 사용 가능한 [`Request`](https://developer.mozilla.org/ko/docs/Web/API/Request) 객체를 반환합니다. 이를 통해 데이터를 수락하고 헤더를 확인할 수 있습니다.
202
207
203
208
```ts title="src/pages/test-post.json.ts"
209
+
importtype { APIRoute } from"astro";
210
+
204
211
exportconst POST = (async ({ request }) => {
205
212
if (request.headers.get("Content-Type") ==="application/json") {
-**`cloudflare`:**[Cloudflare Image Resizing](https://developers.cloudflare.com/images/image-resizing/) 서비스를 사용합니다.
126
126
-**`cloudflare-binding`:** 이미지 변환을 위해 [Cloudflare Images 바인딩](https://developers.cloudflare.com/images/transform-images/bindings/)을 사용합니다. 바인딩은 배포 시 자동으로 프로비저닝됩니다.
127
127
-**`passthrough`:** 기존 [`noop`](/ko/guides/images/#무작동-패스스루-서비스-구성) 서비스를 사용합니다.
128
-
-**`compile`:** 사전 렌더링된 경로에 대해 빌드 시 로컬에서 이미지를 변환하기 위해 내부 의존성 조합을 사용합니다. 주문형 렌더링 페이지에는 noop `passthrough` 옵션이 구성됩니다.
129
-
-**`custom`:** 항상 [이미지 옵션](/ko/reference/configuration-reference/#이미지-옵션)에 구성된 이미지 서비스를 사용합니다. **이 옵션은 구성된 이미지 서비스가 Cloudflare의 `workerd` 런타임에서 작동하는지 확인하지 않습니다.**
128
+
-**`compile`:**[구성된 이미지 서비스](/ko/reference/configuration-reference/#imageservice)를 사용하거나, 이미지 서비스가 구성되지 않은 경우 내부 의존성을 조합하여 사전 렌더링 경로의 이미지를 빌드 시점에 로컬에서 변환합니다. 주문형 렌더링 페이지에서는 아무 작업도 수행하지 않는 `passthrough` 옵션이 사용됩니다.
129
+
-**`custom`:**[구성된 이미지 서비스](/ko/reference/configuration-reference/#imageservice)(기본값: Sharp)를 사용하여 사전 렌더링 경로의 에셋을 빌드 시점에 처리합니다. 또한 런타임 이미지 처리를 위해 이미지 서비스를 번들에 포함하지만, 해당 서비스가 Cloudflare의 `workerd` 런타임과 호환되는지는 검사하지 않습니다.
130
+
130
131
131
132
이미지 서비스를 객체로 구성하여 빌드 시점 서비스와 런타임 서비스를 각각 독립적으로 설정할 수도 있습니다. 현재 빌드 시점 옵션으로는 `'compile'`만 사용할 수 있습니다. 지원되는 런타임 옵션은 `'passthrough'` (기본값) 및 `'cloudflare-binding'`입니다.
Copy file name to clipboardExpand all lines: src/content/docs/ko/guides/integrations-guide/netlify.mdx
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -352,6 +352,7 @@ export default defineConfig({
352
352
- 로컬 [Netlify Blobs](https://docs.netlify.com/build/data-and-storage/netlify-blobs/) 서버. 기본적으로 [세션](#세션)에 사용됩니다.
353
353
- Netlify 구성의 [리디렉션, URL 재작성 (Rewrites)](https://docs.netlify.com/manage/routing/redirects/overview/) 및 [헤더](https://docs.netlify.com/manage/routing/headers/)
354
354
- 요청 시 렌더링되는 페이지에서 [Netlify Edge Context](#사이트에서-에지-컨텍스트에-액세스하기)에 액세스
355
+
- 프로젝트의 `netlify/edge-functions` 디렉터리에 정의된 [Netlify Edge Functions](https://docs.netlify.com/build/edge-functions/overview/) 에뮬레이션
355
356
- Netlify 사이트의 [환경 변수](https://docs.netlify.com/build/environment-variables/overview/)
356
357
357
358
로컬 사이트가 `netlify link`를 사용하여 [Netlify 사이트에 연결](https://docs.netlify.com/api-and-cli-guides/cli-guides/get-started-with-cli/#link-and-unlink-sites)되어 있을 때 가장 잘 작동합니다.
`devFeatures` 옵션은 모든 기능을 활성화 또는 비활성화하는 부울이거나 특정 기능을 활성화하는 객체일 수 있습니다.
370
371
371
-
```js title="astro.config.mjs" ins={7-12}
372
+
```js title="astro.config.mjs" ins={7-14}
372
373
import { defineConfig } from'astro/config';
373
374
importnetlifyfrom'@astrojs/netlify';
374
375
@@ -380,6 +381,8 @@ export default defineConfig({
380
381
images:false,
381
382
// 개발 모드에서 Netlify 환경 변수를 주입합니다. 기본값은 false입니다.
382
383
environmentVariables:true,
384
+
// 개발 모드에서 Netlify Edge Functions를 에뮬레이션합니다. 기본값은 true입니다.
385
+
edgeFunctions:false,
383
386
},
384
387
}),
385
388
});
@@ -409,6 +412,18 @@ Netlify 사이트의 환경 변수를 개발 환경으로 주입합니다.
409
412
410
413
이를 통해 프로덕션 환경과 동일한 값을 개발 환경에서 사용할 수 있습니다. 환경마다 다른 변수를 사용하는 방법을 비롯한 자세한 내용은 [환경 변수에 대한 Netlify 문서](https://docs.netlify.com/build/environment-variables/overview/)를 참조하세요.
411
414
415
+
##### `devFeatures.edgeFunctions`
416
+
417
+
<p>
418
+
**타입:**`boolean`<br />
419
+
**기본값:**`true`<br />
420
+
<Sincev="8.1.0"pkg="@astrojs/netlify"/>
421
+
</p>
422
+
423
+
개발 환경에서 프로젝트의 `netlify/edge-functions` 디렉터리에 정의된 [Netlify Edge Functions](https://docs.netlify.com/build/edge-functions/overview/)을 에뮬레이션합니다.
424
+
425
+
초기화 과정에서 파일 시스템에 접근하는 일부 npm 패키지는 에지 함수 샌드박스 환경에서 작동하지 않으며, `Reading or writing files with Edge Functions is not supported yet`와 같은 오류가 발생할 수 있습니다. 이러한 오류가 발생하는 경우 `edgeFunctions`를 `false`로 설정하여 에지 함수 에뮬레이션을 비활성화하고, 대신 `netlify dev`를 사용하세요. 에지 함수는 프로덕션 빌드에서는 계속 정상적으로 동작합니다.
Copy file name to clipboardExpand all lines: src/content/docs/ko/guides/middleware.mdx
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -257,6 +257,8 @@ export function onRequest (context, next) {
257
257
이 시그니처로 `next()`를 호출하면 이전 `ctx.request`를 사용하여 새 `Request` 객체가 생성됩니다. 즉, 이 리라이트 전이나 후에 `Request.body`를 사용하려고 하면 런타임 오류가 발생합니다. 이 오류는 [HTML 양식을 사용하는 Astro 액션](/ko/guides/actions/#html-양식-액션에서-액션-호출)에서 자주 발생합니다. 이러한 경우 미들웨어를 대신 `Astro.rewrite()`를 사용하여 Astro 템플릿에서 리라이트를 처리하는 것이 좋습니다.
Copy file name to clipboardExpand all lines: src/content/docs/ko/guides/typescript.mdx
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -306,13 +306,14 @@ Astro는 동적 라우트를 위한 [`getStaticPaths()`](/ko/reference/routing-r
306
306
307
307
`InferGetStaticParamsType`으로 [`Astro.params`](/ko/reference/api-reference/#params)의 타입을 얻고, `InferGetStaticPropsType`으로 [`Astro.props`](/ko/reference/api-reference/#props)의 타입을 얻을 수 있습니다. 또는 `GetStaticPaths`를 사용하여 두 타입을 모두 얻을 수 있습니다.
0 commit comments