Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌐 Add Korean translation for docs/ko/docs/tutorial/middleware.md #2829

Merged
merged 31 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4c72d00
Add Korean Translation for Tutorial - Middleware
JeongHyeongKim Feb 18, 2021
a2ee84a
update some words
JeongHyeongKim Feb 18, 2021
8ebda36
apply feedback
JeongHyeongKim Mar 2, 2021
b1d721f
apply feedback
JeongHyeongKim Mar 2, 2021
6bfb733
remove term '당신'
JeongHyeongKim Mar 2, 2021
0f2c891
modity format to en
JeongHyeongKim Mar 2, 2021
6b31dc6
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim May 11, 2021
1695e7f
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim May 11, 2021
1efab28
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim May 11, 2021
556dada
Merge branch 'master' into master
JeongHyeongKim May 11, 2021
7146aec
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim May 11, 2021
a892b90
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim May 11, 2021
dc771bd
Merge branch 'tiangolo:master' into master
JeongHyeongKim Jul 7, 2021
7e1f926
Merge branch 'tiangolo:master' into master
JeongHyeongKim Aug 19, 2021
1f301c2
Merge branch 'tiangolo:master' into master
JeongHyeongKim Sep 2, 2021
116f2a7
Merge branch 'tiangolo:master' into master
JeongHyeongKim Sep 11, 2021
a77f979
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim Dec 9, 2021
be6aa46
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim Dec 9, 2021
dcd077d
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim Dec 9, 2021
4ca3ac7
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim Dec 9, 2021
02944dd
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim Dec 9, 2021
b5b09b7
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim Dec 9, 2021
470b1e6
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim Dec 9, 2021
1faa465
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim Dec 9, 2021
0d7f133
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim Dec 9, 2021
3c5bd36
Update docs/ko/docs/tutorial/middleware.md
JeongHyeongKim Dec 9, 2021
15fe78f
Merge branch 'master' into master
JeongHyeongKim Dec 9, 2021
02f34f3
Update middleware.md
JeongHyeongKim Dec 9, 2021
d8bd0ec
Merge branch 'master' into master
JeongHyeongKim Sep 23, 2022
2241794
Merge branch 'master' into master
tiangolo Dec 16, 2022
9e0718c
Merge branch 'master' into master
tiangolo Jun 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
61 changes: 61 additions & 0 deletions docs/ko/docs/tutorial/middleware.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# 미들웨어

당신은 미들웨어를 **FastAPI** 어플리케이션에 추가할 수 있습니다.
JeongHyeongKim marked this conversation as resolved.
Show resolved Hide resolved

"미들웨어"는 특정 *path operation*에 의해 처리되기 전, 모든 **request**에 대해서 동작하는 함수입니다. 또한 모든 **response**가 반환되기 전에도 동일하게 동작합니다.
JeongHyeongKim marked this conversation as resolved.
Show resolved Hide resolved

* 미들웨어는 당신의 어플리케이션으로 오는 **request**를 가져옵니다.
* **request** 또는 다른 필요한 코드를 실행 시키는 동작을 할 수 있습니다.
* **reqeust**를 전달하여 일부 어플리케이션에서 처리합니다 (일부 *path 작업 *에 의해).
* 어플리케이션에서 생성한 **response**를 받습니다 (일부 *path 작업 *에 의해).
* **response** 또는 다른 필요한 코드를 실행시키는 동작을 할 수 있습니다.
* **response**를 반환합니다. 그런 다음 ** 요청 **을 전달하여 나머지 응용 프로그램에서 처리합니다 (일부 *path 작업 *에 의해).
JeongHyeongKim marked this conversation as resolved.
Show resolved Hide resolved

!!! note "기술 세부사항"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!!! note "기술 세부사항"
!!! note "기술적 세부사항"

And also check 파이썬 공식 한국어 문서에 없는 용어 중 현재 사용하고 있는 용어 in #3167 .

만약 당신이`yield`를 사용한 의존성을 가지고 있다면, 미들웨어가 실행되고 난 후에 exit이 실행될 것입니다.
JeongHyeongKim marked this conversation as resolved.
Show resolved Hide resolved

만약 백그라운드 작업이 있다면, 그것들은 모든 미들웨어가 실행되고 나서 실행될 것입니다.
JeongHyeongKim marked this conversation as resolved.
Show resolved Hide resolved

## 미들웨어 작성하기
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 미들웨어 작성하기
## 미들웨어 만들기

It's okay but I think "만들기" is better.


미들웨어를 작성하기 위해서 당신은 함수 상단에 `@app.middleware("http")` 데코레이터를 사용할 수 있습니다.

미들웨어 함수은 다음 항목들을 받습니다:
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
미들웨어 함수은 다음 항목들을 받습니다:
미들웨어 함수는 다음 항목들을 받습니다:


* `request`.
* `request`를 파라미터로 받는 `call_next` 함수.
JeongHyeongKim marked this conversation as resolved.
Show resolved Hide resolved
* 이 함수은 `request`를 해당하는 *path operation*으로 전달합니다.
* 그런다음, *path operation*에 의해 생성된 `response` 를 반환합니다.
JeongHyeongKim marked this conversation as resolved.
Show resolved Hide resolved
* 당신은 `response`를 반환하기 전에 추가로 `response`를 수정할 수 있습니다.

```Python hl_lines="8-9 11 14"
{!../../../docs_src/middleware/tutorial001.py!}
```

!!! 팁
JeongHyeongKim marked this conversation as resolved.
Show resolved Hide resolved
사용자 정의 헤더는 <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers" class="external-link" target="_blank">'X-' 접두사를 사용</a>하여 추가할 수 있습니다.

그러나 만약 클라이언트의 브라우저에서 볼 수 있는 사용자 정의 헤더를 가지고 있다면, 그것들을 CORS 설정([CORS (Cross-Origin Resource Sharing)](cors.md){.internal-link target=_blank})에 <a href="https://www.starlette.io/middleware/#corsmiddleware" class="external-link" target="_blank">Starlette CORS 문서</a>에 명시된 `expose_headers` 파라미터를 이용하여 헤더들을 추가하여야합니다.

!!! note "기술 세부사항"
JeongHyeongKim marked this conversation as resolved.
Show resolved Hide resolved
당신은 `from starlette.requests import Request`를 사용할 수도 있습니다.

**FastAPI**는 개발자에게 편의성을 제공합니다. 그러나 Starlette에서 직접 제공됩니다.
JeongHyeongKim marked this conversation as resolved.
Show resolved Hide resolved

### `response`의 전과 후

당신은 *path operation*을 받기 전 `request`와 함께 동작할 수 있는 코드를 추가할 수 있습니다.

그리고 `response` 또한 생성된 후 반환되기 전에 코드를 추가 할 수 있습니다.

예를 들어, 당신은 요청을 수행하고 응답을 생성하는데 까지 걸린 시간 값을 가지고 있는 `X-Process-Time` 같은 커스텀 헤더를 추가할 수 있습니다.
JeongHyeongKim marked this conversation as resolved.
Show resolved Hide resolved

```Python hl_lines="10 12-13"
{!../../../docs_src/middleware/tutorial001.py!}
```

## 그 이외의 미들웨어
JeongHyeongKim marked this conversation as resolved.
Show resolved Hide resolved

당신은 미들웨어 대한 더 많은 정보를 [숙련자 사용 가이드: 향상된 미들웨어](../advanced/middleware.md){.internal-link target=\_blank}에서 읽을 수 있습니다.

다음 섹션에서 당신은 미들웨어를 어떻게 다루는지에 대해 읽을 것입니다.
2 changes: 2 additions & 0 deletions docs/ko/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ nav:
- tr: /tr/
- uk: /uk/
- zh: /zh/
- 자습서 - 사용자 안내서:
- tutorial/middleware.md
markdown_extensions:
- toc:
permalink: true
Expand Down