diff --git a/_data/ko/footer.yml b/_data/ko/footer.yml index fe92f52ca8..2070e3102d 100644 --- a/_data/ko/footer.yml +++ b/_data/ko/footer.yml @@ -1,6 +1,6 @@ -terms_of_use: Terms of Use -privacy_policy: Privacy Policy -coc: Code of Conduct -trademark_policy: Trademark Policy -security_policy: Security Policy -license: License +terms_of_use: 이용 약관 +privacy_policy: 개인정보보호정책 +coc: 운영 규정 +trademark_policy: 상표 정책 +security_policy: 보안 정책 +license: 라이선스 diff --git a/_data/ko/general.yml b/_data/ko/general.yml index e6327e6214..a1fd55a3c7 100644 --- a/_data/ko/general.yml +++ b/_data/ko/general.yml @@ -1,8 +1,8 @@ -title_announcement: "Express@5.1.0: Now the Default on npm with LTS Timeline" -body_announcement: "Express 5.1.0 is now the default on npm, and we're introducing an official LTS schedule for the v4 and v5 release lines. Check out our latest blog for more information." -community-caveat-alert: "This information refers to third-party sites, products, or modules that are not maintained by the Expressjs team. Listing here does not constitute an endorsement or recommendation from the Expressjs project team." -warning: 'Warning' -note: 'Note' -caution: 'Caution' -i18n_notice: "This document might be outdated relative to the documentation in English. For the latest updates, please refer to the" -i18n_notice_link_text: "documentation in english" +title_announcement: "Express@5.1.0: npm에서 기본 버전으로 채택, LTS 일정 함께 도입됨" +body_announcement: "이제 Express 5.1.0이 npm에서 기본 버전이 되었으며, v4와 v5 릴리스 라인에 대해 공식적인 LTS 일정도 도입했습니다.\n자세한 내용은 최신 블로그를 확인해보세요." +community-caveat-alert: "이 정보는 Expressjs 팀에서 관리하지 않는 서드파티 사이트, 제품 또는 모듈에 관한 것입니다. 여기에 나열된다고 해서 Expressjs 프로젝트 팀이 이를 보증하거나 추천한다는 의미는 아닙니다." +warning: '경고' +note: '참고' +caution: '주의' +i18n_notice: "이 문서는 영어 문서에 비해 최신 정보가 아닐 수 있습니다. 최신 내용을 확인하려면 아래의 영어 문서를 참고해 주시기 바랍니다" +i18n_notice_link_text: "영어로 된 문서" diff --git a/de/guide/migrating-5.md b/de/guide/migrating-5.md index a14b95a483..8c3528dfd5 100644 --- a/de/guide/migrating-5.md +++ b/de/guide/migrating-5.md @@ -51,7 +51,7 @@ You can find the list of available codemods [here](https://github.com/expressjs/
  • req.param(name)
  • res.json(obj, status)
  • res.jsonp(obj, status)
  • -
  • res.redirect('back') and res.location('back')
  • +
  • res.redirect('back') and res.location('back')
  • res.redirect(url, status)
  • res.send(body, status)
  • res.send(status)
  • @@ -325,6 +325,15 @@ app.get('/user', (req, res) => { Die Funktion `res.sendfile()` wurde durch eine Version in Camel-Schreibweise von `res.sendFile()` in Express 5 ersetzt. +**Note:** In Express 5, `res.sendFile()` uses the `mime-types` package for MIME type detection, which returns different Content-Type values than Express 4 for several common file types: + +- JavaScript files (.js): now "text/javascript" instead of "application/javascript" +- JSON files (.json): now "application/json" instead of "text/json" +- CSS files (.css): now "text/css" instead of "text/plain" +- XML files (.xml): now "application/xml" instead of "text/xml" +- Font files (.woff): now "font/woff" instead of "application/font-woff" +- SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" + {% include admonitions/note.html content=codemod-deprecated-signatures %} ```js @@ -348,6 +357,15 @@ The `router.param(fn)` signature was used for modifying the behavior of the `rou In Express 5, `mime` is no longer an exported property of the `static` field. Use the [`mime-types` package](https://github.com/jshttp/mime-types) to work with MIME type values. +**Important:** This change affects not only direct usage of `express.static.mime` but also other Express methods that rely on MIME type detection, such as `res.sendFile()`. The following MIME types have changed from Express 4: + +- JavaScript files (.js): now served as "text/javascript" instead of "application/javascript" +- JSON files (.json): now served as "application/json" instead of "text/json" +- CSS files (.css): now served as "text/css" instead of "text/plain" +- HTML files (.html): now served as "text/html; charset=utf-8" instead of just "text/html" +- XML files (.xml): now served as "application/xml" instead of "text/xml" +- Font files (.woff): now served as "font/woff" instead of "application/font-woff" + ```js // v4 express.static.mime.lookup('json') diff --git a/es/guide/migrating-5.md b/es/guide/migrating-5.md index 8cc379b18d..9ff966b5a7 100644 --- a/es/guide/migrating-5.md +++ b/es/guide/migrating-5.md @@ -51,7 +51,7 @@ You can find the list of available codemods [here](https://github.com/expressjs/
  • req.param(name)
  • res.json(obj, status)
  • res.jsonp(obj, status)
  • -
  • res.redirect('back') and res.location('back')
  • +
  • res.redirect('back') and res.location('back')
  • res.redirect(url, status)
  • res.send(body, status)
  • res.send(status)
  • @@ -325,6 +325,15 @@ app.get('/user', (req, res) => { La función `res.sendfile()` se ha sustituido por una versión de la función `res.sendFile()` con cada palabra en mayúscula en Express 5. +**Note:** In Express 5, `res.sendFile()` uses the `mime-types` package for MIME type detection, which returns different Content-Type values than Express 4 for several common file types: + +- JavaScript files (.js): now "text/javascript" instead of "application/javascript" +- JSON files (.json): now "application/json" instead of "text/json" +- CSS files (.css): now "text/css" instead of "text/plain" +- XML files (.xml): now "application/xml" instead of "text/xml" +- Font files (.woff): now "font/woff" instead of "application/font-woff" +- SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" + {% include admonitions/note.html content=codemod-deprecated-signatures %} ```js @@ -348,6 +357,15 @@ The `router.param(fn)` signature was used for modifying the behavior of the `rou In Express 5, `mime` is no longer an exported property of the `static` field. Use the [`mime-types` package](https://github.com/jshttp/mime-types) to work with MIME type values. +**Important:** This change affects not only direct usage of `express.static.mime` but also other Express methods that rely on MIME type detection, such as `res.sendFile()`. The following MIME types have changed from Express 4: + +- JavaScript files (.js): now served as "text/javascript" instead of "application/javascript" +- JSON files (.json): now served as "application/json" instead of "text/json" +- CSS files (.css): now served as "text/css" instead of "text/plain" +- HTML files (.html): now served as "text/html; charset=utf-8" instead of just "text/html" +- XML files (.xml): now served as "application/xml" instead of "text/xml" +- Font files (.woff): now served as "font/woff" instead of "application/font-woff" + ```js // v4 express.static.mime.lookup('json') diff --git a/fr/guide/migrating-5.md b/fr/guide/migrating-5.md index f1d8058eaa..8f31b07a9c 100644 --- a/fr/guide/migrating-5.md +++ b/fr/guide/migrating-5.md @@ -60,7 +60,7 @@ nom pour app.param(name, fn)
  • req.param(name)
  • res.json(obj, status)
  • res.jsonp(obj, status)
  • -
  • res.redirect('back') and res.location('back')
  • +
  • res.redirect('back') and res.location('back')
  • res.redirect(url, status)
  • res.send(body, status)
  • res.send(status)
  • @@ -378,6 +378,15 @@ La fonction `res.sendfile()` a été remplacée par une version CamelCase `res.sendFile()` dans Express 5. +**Note:** In Express 5, `res.sendFile()` uses the `mime-types` package for MIME type detection, which returns different Content-Type values than Express 4 for several common file types: + +- JavaScript files (.js): now "text/javascript" instead of "application/javascript" +- JSON files (.json): now "application/json" instead of "text/json" +- CSS files (.css): now "text/css" instead of "text/plain" +- XML files (.xml): now "application/xml" instead of "text/xml" +- Font files (.woff): now "font/woff" instead of "application/font-woff" +- SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" + {% include admonitions/note.html content=codemod-deprecated-signatures %} ```js @@ -402,6 +411,15 @@ version 4.11.0 et Express 5 ne la prend plus en charge. In Express 5, `mime` is no longer an exported property of the `static` field. Use the [`mime-types` package](https://github.com/jshttp/mime-types) to work with MIME type values. +**Important:** This change affects not only direct usage of `express.static.mime` but also other Express methods that rely on MIME type detection, such as `res.sendFile()`. The following MIME types have changed from Express 4: + +- JavaScript files (.js): now served as "text/javascript" instead of "application/javascript" +- JSON files (.json): now served as "application/json" instead of "text/json" +- CSS files (.css): now served as "text/css" instead of "text/plain" +- HTML files (.html): now served as "text/html; charset=utf-8" instead of just "text/html" +- XML files (.xml): now served as "application/xml" instead of "text/xml" +- Font files (.woff): now served as "font/woff" instead of "application/font-woff" + ```js // v4 express.static.mime.lookup('json') diff --git a/it/guide/migrating-5.md b/it/guide/migrating-5.md index 711a3050c8..c9076b434d 100644 --- a/it/guide/migrating-5.md +++ b/it/guide/migrating-5.md @@ -51,7 +51,7 @@ You can find the list of available codemods [here](https://github.com/expressjs/
  • req.param(name)
  • res.json(obj, status)
  • res.jsonp(obj, status)
  • -
  • res.redirect('back') and res.location('back')
  • +
  • res.redirect('back') and res.location('back')
  • res.redirect(url, status)
  • res.send(body, status)
  • res.send(status)
  • @@ -325,6 +325,15 @@ app.get('/user', (req, res) => { La funzione `res.sendfile()` è stata sostituita da una versione in cui ogni frase composta inizia con una lettera maiuscola che utilizza ad esempio `res.sendFile()` in Express 5. +**Note:** In Express 5, `res.sendFile()` uses the `mime-types` package for MIME type detection, which returns different Content-Type values than Express 4 for several common file types: + +- JavaScript files (.js): now "text/javascript" instead of "application/javascript" +- JSON files (.json): now "application/json" instead of "text/json" +- CSS files (.css): now "text/css" instead of "text/plain" +- XML files (.xml): now "application/xml" instead of "text/xml" +- Font files (.woff): now "font/woff" instead of "application/font-woff" +- SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" + {% include admonitions/note.html content=codemod-deprecated-signatures %} ```js @@ -348,6 +357,15 @@ The `router.param(fn)` signature was used for modifying the behavior of the `rou In Express 5, `mime` is no longer an exported property of the `static` field. Use the [`mime-types` package](https://github.com/jshttp/mime-types) to work with MIME type values. +**Important:** This change affects not only direct usage of `express.static.mime` but also other Express methods that rely on MIME type detection, such as `res.sendFile()`. The following MIME types have changed from Express 4: + +- JavaScript files (.js): now served as "text/javascript" instead of "application/javascript" +- JSON files (.json): now served as "application/json" instead of "text/json" +- CSS files (.css): now served as "text/css" instead of "text/plain" +- HTML files (.html): now served as "text/html; charset=utf-8" instead of just "text/html" +- XML files (.xml): now served as "application/xml" instead of "text/xml" +- Font files (.woff): now served as "font/woff" instead of "application/font-woff" + ```js // v4 express.static.mime.lookup('json') diff --git a/ja/guide/migrating-5.md b/ja/guide/migrating-5.md index 02c673d2fe..f70448ac02 100644 --- a/ja/guide/migrating-5.md +++ b/ja/guide/migrating-5.md @@ -51,7 +51,7 @@ You can find the list of available codemods [here](https://github.com/expressjs/
  • req.param(name)
  • res.json(obj, status)
  • res.jsonp(obj, status)
  • -
  • res.redirect('back') and res.location('back')
  • +
  • res.redirect('back') and res.location('back')
  • res.redirect(url, status)
  • res.send(body, status)
  • res.send(status)
  • @@ -325,6 +325,15 @@ app.get('/user', (req, res) => { `res.sendfile()` 関数は、Express 5 ではキャメルケース版の `res.sendFile()` に置き換えられます。 +**Note:** In Express 5, `res.sendFile()` uses the `mime-types` package for MIME type detection, which returns different Content-Type values than Express 4 for several common file types: + +- JavaScript files (.js): now "text/javascript" instead of "application/javascript" +- JSON files (.json): now "application/json" instead of "text/json" +- CSS files (.css): now "text/css" instead of "text/plain" +- XML files (.xml): now "application/xml" instead of "text/xml" +- Font files (.woff): now "font/woff" instead of "application/font-woff" +- SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" + {% include admonitions/note.html content=codemod-deprecated-signatures %} ```js @@ -348,6 +357,15 @@ The `router.param(fn)` signature was used for modifying the behavior of the `rou In Express 5, `mime` is no longer an exported property of the `static` field. Use the [`mime-types` package](https://github.com/jshttp/mime-types) to work with MIME type values. +**Important:** This change affects not only direct usage of `express.static.mime` but also other Express methods that rely on MIME type detection, such as `res.sendFile()`. The following MIME types have changed from Express 4: + +- JavaScript files (.js): now served as "text/javascript" instead of "application/javascript" +- JSON files (.json): now served as "application/json" instead of "text/json" +- CSS files (.css): now served as "text/css" instead of "text/plain" +- HTML files (.html): now served as "text/html; charset=utf-8" instead of just "text/html" +- XML files (.xml): now served as "application/xml" instead of "text/xml" +- Font files (.woff): now served as "font/woff" instead of "application/font-woff" + ```js // v4 express.static.mime.lookup('json') diff --git a/ko/3x/api.md b/ko/3x/api.md index db7a643be8..311080b997 100644 --- a/ko/3x/api.md +++ b/ko/3x/api.md @@ -2,7 +2,7 @@ layout: api version: 3x title: Express 3.x - API 참조 -description: Access the API reference for Express.js version 3.x, noting that this version is end-of-life and no longer maintained - includes details on modules and methods. +description: Express.js 3.x 버전의 API 참조에 접근할 수 있습니다. 이 버전은 지원이 종료되었으며 더 이상 유지보수되지 않습니다. 모듈과 메소드에 대한 상세한 정보가 포함되어 있습니다. lang: ko redirect_from: " " --- diff --git a/ko/advanced/best-practice-performance.md b/ko/advanced/best-practice-performance.md index e2d1fc9e8f..34b8be5dd0 100644 --- a/ko/advanced/best-practice-performance.md +++ b/ko/advanced/best-practice-performance.md @@ -1,7 +1,7 @@ --- layout: page title: 프로덕션 환경에서의 Express 사용을 위한 성능 우수 사례 -description: Discover performance and reliability best practices for Express apps in production, covering code optimizations and environment setups for optimal performance. +description: Express 애플리케이션의 프로덕션 환경에서 성능과 안정성을 최적화하기 위한 모범 사례를 알아봅니다. 여기에는 코드 최적화와 최적의 성능을 위한 환경 설정이 포함됩니다. menu: advanced lang: ko redirect_from: " " @@ -55,11 +55,11 @@ app.use(compression()) Node 및 다수의 모듈은 동기식 및 비동기식 버전의 함수를 제공하지만, 프로덕션 환경에서는 항상 비동기식 버전을 사용하십시오. 동기식 함수의 사용이 정당화되는 유일한 경우는 초기 시작 시에 사용되는 경우입니다. -You can use the `--trace-sync-io` command-line flag to print a warning and a stack trace whenever your application uses a synchronous API. 물론, 프로덕션 환경에서 이러한 플래그를 실제로 사용해서는 안 되며, 이는 코드가 프로덕션 환경에서 사용될 준비가 되었다는 것을 보장하기 위한 것입니다. 자세한 정보는 [node 커맨드라인 옵션 문서](https://nodejs.org/api/cli.html#cli_trace_sync_io)를 참조하십시오. +애플리케이션이 동기 API를 사용할 때마다 경고 메시지와 스택 트레이스를 출력하려면 --trace-sync-io 명령줄 플래그를 사용할 수 있습니다. 물론, 프로덕션 환경에서 이러한 플래그를 실제로 사용해서는 안 되며, 이는 코드가 프로덕션 환경에서 사용될 준비가 되었다는 것을 보장하기 위한 것입니다. 자세한 정보는 [node 커맨드라인 옵션 문서](https://nodejs.org/api/cli.html#cli_trace_sync_io)를 참조하십시오. ### Do logging correctly -일반적으로 앱은 디버깅 그리고 앱 활동 로깅(사실상 디버깅 이외의 모든 것)이라는 두 가지 이유로 인해 로깅을 실행합니다. `console.log()` 또는 `console.err()`을 사용하여 터미널에 로그 메시지를 출력하는 것이 일반적인 개발 작업 방식입니다. But [these functions are synchronous](https://nodejs.org/api/console.html#console) when the destination is a terminal or a file, so they are not suitable for production, unless you pipe the output to another program. +일반적으로 앱은 디버깅 그리고 앱 활동 로깅(사실상 디버깅 이외의 모든 것)이라는 두 가지 이유로 인해 로깅을 실행합니다. `console.log()` 또는 `console.err()`을 사용하여 터미널에 로그 메시지를 출력하는 것이 일반적인 개발 작업 방식입니다. 단, [이 함수들은](https://nodejs.org/api/console.html#console) 출력 대상이 터미널이나 파일일 경우 동기적으로 동작하므로, 출력 결과를 다른 프로그램으로 파이프하지 않는 이상 프로덕션 환경에서는 적합하지 않습니다. #### For debugging diff --git a/ko/guide/migrating-5.md b/ko/guide/migrating-5.md index 30f7d491cd..76abee93a6 100644 --- a/ko/guide/migrating-5.md +++ b/ko/guide/migrating-5.md @@ -51,7 +51,7 @@ You can find the list of available codemods [here](https://github.com/expressjs/
  • req.param(name)
  • res.json(obj, status)
  • res.jsonp(obj, status)
  • -
  • res.redirect('back') and res.location('back')
  • +
  • res.redirect('back') and res.location('back')
  • res.redirect(url, status)
  • res.send(body, status)
  • res.send(status)
  • @@ -325,6 +325,15 @@ app.get('/user', (req, res) => { Express 5에서 `res.sendfile()` 함수는 낙타 대문자(camel-cased) 버전인 `res.sendFile()`로 대체되었습니다. +**Note:** In Express 5, `res.sendFile()` uses the `mime-types` package for MIME type detection, which returns different Content-Type values than Express 4 for several common file types: + +- JavaScript files (.js): now "text/javascript" instead of "application/javascript" +- JSON files (.json): now "application/json" instead of "text/json" +- CSS files (.css): now "text/css" instead of "text/plain" +- XML files (.xml): now "application/xml" instead of "text/xml" +- Font files (.woff): now "font/woff" instead of "application/font-woff" +- SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" + {% include admonitions/note.html content=codemod-deprecated-signatures %} ```js @@ -348,6 +357,15 @@ The `router.param(fn)` signature was used for modifying the behavior of the `rou In Express 5, `mime` is no longer an exported property of the `static` field. Use the [`mime-types` package](https://github.com/jshttp/mime-types) to work with MIME type values. +**Important:** This change affects not only direct usage of `express.static.mime` but also other Express methods that rely on MIME type detection, such as `res.sendFile()`. The following MIME types have changed from Express 4: + +- JavaScript files (.js): now served as "text/javascript" instead of "application/javascript" +- JSON files (.json): now served as "application/json" instead of "text/json" +- CSS files (.css): now served as "text/css" instead of "text/plain" +- HTML files (.html): now served as "text/html; charset=utf-8" instead of just "text/html" +- XML files (.xml): now served as "application/xml" instead of "text/xml" +- Font files (.woff): now served as "font/woff" instead of "application/font-woff" + ```js // v4 express.static.mime.lookup('json') diff --git a/ko/guide/overriding-express-api.md b/ko/guide/overriding-express-api.md index 531bdd1e64..4d8e7987e6 100644 --- a/ko/guide/overriding-express-api.md +++ b/ko/guide/overriding-express-api.md @@ -1,7 +1,7 @@ --- layout: page title: Overriding the Express API -description: Discover how to customize and extend the Express.js API by overriding methods and properties on the request and response objects using prototypes. +description: 프로토타입을 사용해 request와 response 객체의 메서드와 속성을 오버라이드하여 Express.js API를 커스터마이즈하고 확장하는 방법을 알아보세요. menu: guide lang: ko --- diff --git a/ko/index.md b/ko/index.md index 4f8189590c..b11cf491b0 100644 --- a/ko/index.md +++ b/ko/index.md @@ -1,7 +1,7 @@ --- layout: home title: Express - Node.js web application framework -description: "Express is a fast, unopinionated, minimalist web framework for Node.js, providing a robust set of features for web and mobile applications." +description: "Express는 빠르고, 특정 방식에 얽매이지 않으며, 최소한의 구조를 지닌 Node.js용 웹 프레임워크로, 웹 및 모바일 애플리케이션을 위한 강력한 기능들을 제공합니다." menu: home lang: ko redirect_from: " " diff --git a/pt-br/guide/migrating-5.md b/pt-br/guide/migrating-5.md index 801e29b827..064c0b93f7 100644 --- a/pt-br/guide/migrating-5.md +++ b/pt-br/guide/migrating-5.md @@ -60,7 +60,7 @@ You can find the list of available codemods [here](https://github.com/expressjs/
  • req.param(name)
  • res.json(obj, status)
  • res.jsonp(obj, status)
  • -
  • res.redirect('back') and res.location('back')
  • +
  • res.redirect('back') and res.location('back')
  • res.redirect(url, status)
  • res.send(body, status)
  • res.send(status)
  • @@ -368,6 +368,15 @@ A função `res.sendfile()` foi substituída pela versão em formato camel-case `res.sendFile()` no Express 5. +**Note:** In Express 5, `res.sendFile()` uses the `mime-types` package for MIME type detection, which returns different Content-Type values than Express 4 for several common file types: + +- JavaScript files (.js): now "text/javascript" instead of "application/javascript" +- JSON files (.json): now "application/json" instead of "text/json" +- CSS files (.css): now "text/css" instead of "text/plain" +- XML files (.xml): now "application/xml" instead of "text/xml" +- Font files (.woff): now "font/woff" instead of "application/font-woff" +- SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" + {% include admonitions/note.html content=codemod-deprecated-signatures %} ```js @@ -392,6 +401,15 @@ foi descontinuada desde a v4.11.0, e o Express 5 não a suporta mais de nenhuma In Express 5, `mime` is no longer an exported property of the `static` field. Use the [`mime-types` package](https://github.com/jshttp/mime-types) to work with MIME type values. +**Important:** This change affects not only direct usage of `express.static.mime` but also other Express methods that rely on MIME type detection, such as `res.sendFile()`. The following MIME types have changed from Express 4: + +- JavaScript files (.js): now served as "text/javascript" instead of "application/javascript" +- JSON files (.json): now served as "application/json" instead of "text/json" +- CSS files (.css): now served as "text/css" instead of "text/plain" +- HTML files (.html): now served as "text/html; charset=utf-8" instead of just "text/html" +- XML files (.xml): now served as "application/xml" instead of "text/xml" +- Font files (.woff): now served as "font/woff" instead of "application/font-woff" + ```js // v4 express.static.mime.lookup('json') diff --git a/zh-cn/api.md b/zh-cn/api.md index a7d47e3261..7e13d1afbf 100644 --- a/zh-cn/api.md +++ b/zh-cn/api.md @@ -2,7 +2,7 @@ layout: api version: 5x title: Express 5.x - API 参考 -description: Access the API reference for Express.js detailing all modules, methods, and properties for building web applications with this version. +description: 访问 Express.js API 参考文档,获取当前版本所有模块、方法及属性的详细说明,助您构建 Web 应用。 lang: en redirect_from: " " --- diff --git a/zh-cn/guide/migrating-5.md b/zh-cn/guide/migrating-5.md index b7e86ee935..fa01cf487c 100644 --- a/zh-cn/guide/migrating-5.md +++ b/zh-cn/guide/migrating-5.md @@ -51,7 +51,7 @@ You can find the list of available codemods [here](https://github.com/expressjs/
  • req.param(name)
  • res.json(obj, status)
  • res.jsonp(obj, status)
  • -
  • res.redirect('back') and res.location('back')
  • +
  • res.redirect('back') and res.location('back')
  • res.redirect(url, status)
  • res.send(body, status)
  • res.send(status)
  • @@ -325,6 +325,15 @@ app.get('/user', (req, res) => { 在 Express 5 中,`res.sendfile()` 函数已由驼峰式大小写版本 `res.sendFile()` 替换。 +**Note:** In Express 5, `res.sendFile()` uses the `mime-types` package for MIME type detection, which returns different Content-Type values than Express 4 for several common file types: + +- JavaScript files (.js): now "text/javascript" instead of "application/javascript" +- JSON files (.json): now "application/json" instead of "text/json" +- CSS files (.css): now "text/css" instead of "text/plain" +- XML files (.xml): now "application/xml" instead of "text/xml" +- Font files (.woff): now "font/woff" instead of "application/font-woff" +- SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" + {% include admonitions/note.html content=codemod-deprecated-signatures %} ```js @@ -348,6 +357,15 @@ The `router.param(fn)` signature was used for modifying the behavior of the `rou In Express 5, `mime` is no longer an exported property of the `static` field. Use the [`mime-types` package](https://github.com/jshttp/mime-types) to work with MIME type values. +**Important:** This change affects not only direct usage of `express.static.mime` but also other Express methods that rely on MIME type detection, such as `res.sendFile()`. The following MIME types have changed from Express 4: + +- JavaScript files (.js): now served as "text/javascript" instead of "application/javascript" +- JSON files (.json): now served as "application/json" instead of "text/json" +- CSS files (.css): now served as "text/css" instead of "text/plain" +- HTML files (.html): now served as "text/html; charset=utf-8" instead of just "text/html" +- XML files (.xml): now served as "application/xml" instead of "text/xml" +- Font files (.woff): now served as "font/woff" instead of "application/font-woff" + ```js // v4 express.static.mime.lookup('json') diff --git a/zh-cn/index.md b/zh-cn/index.md index 7653247869..d68859a989 100644 --- a/zh-cn/index.md +++ b/zh-cn/index.md @@ -1,7 +1,7 @@ --- layout: home -title: Express - Node.js web application framework -description: "Express is a fast, unopinionated, minimalist web framework for Node.js, providing a robust set of features for web and mobile applications." +title: Express - Node.js web 应用框架 +description: "Express 是 Node.js 的一个快速、灵活、极简的Web框架,为网页和移动应用提供了一套强大的功能特性。" menu: home lang: en redirect_from: " " @@ -11,7 +11,7 @@ redirect_from: " "
    -

    Fast, unopinionated, minimalist web framework for Node.js

    +

    快速、灵活、极简的 Node.js Web 框架

    $ npm install express --save
    @@ -45,18 +45,18 @@ app.listen(port, () => {
    -

    Web Applications

    Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. +

    Web 应用开发

    Express 是一个简洁灵活的 Node.js Web 应用框架,为网页和移动应用提供了一套强大的功能特性。
    -

    APIs

    With a myriad of HTTP utility methods and middleware at your disposal, creating a robust API is quick and easy. +

    API 开发

    借助丰富的 HTTP 工具方法和中间件支持,快速构建健壮的 API 接口易如反掌。
    -

    Performance

    Express provides a thin layer of fundamental web application features, without obscuring Node.js features that you know and love. +

    性能表现

    Express 提供基础的 Web 应用功能薄层封装,绝不遮蔽您熟悉且喜爱的原生 Node.js 特性。

    中间件

    - Express is a lightweight and flexible routing framework with minimal core features - meant to be augmented through the use of Express middleware modules. + Express是一个轻量和灵活的路由框架,核心功能最小, + 将通过使用Express 中间件 模块来增加。
    diff --git a/zh-tw/guide/migrating-5.md b/zh-tw/guide/migrating-5.md index 7d9f49348a..5ce0cbb13b 100644 --- a/zh-tw/guide/migrating-5.md +++ b/zh-tw/guide/migrating-5.md @@ -51,7 +51,7 @@ You can find the list of available codemods [here](https://github.com/expressjs/
  • req.param(name)
  • res.json(obj, status)
  • res.jsonp(obj, status)
  • -
  • res.redirect('back') and res.location('back')
  • +
  • res.redirect('back') and res.location('back')
  • res.redirect(url, status)
  • res.send(body, status)
  • res.send(status)
  • @@ -326,6 +326,15 @@ app.get('/user', (req, res) => { `res.sendfile()` 函數已被 Express 5 中的駝峰式大小寫版本 `res.sendFile()` 取代。 +**Note:** In Express 5, `res.sendFile()` uses the `mime-types` package for MIME type detection, which returns different Content-Type values than Express 4 for several common file types: + +- JavaScript files (.js): now "text/javascript" instead of "application/javascript" +- JSON files (.json): now "application/json" instead of "text/json" +- CSS files (.css): now "text/css" instead of "text/plain" +- XML files (.xml): now "application/xml" instead of "text/xml" +- Font files (.woff): now "font/woff" instead of "application/font-woff" +- SVG files (.svg): now "image/svg+xml" instead of "application/svg+xml" + {% include admonitions/note.html content=codemod-deprecated-signatures %} ```js @@ -349,6 +358,15 @@ The `router.param(fn)` signature was used for modifying the behavior of the `rou In Express 5, `mime` is no longer an exported property of the `static` field. Use the [`mime-types` package](https://github.com/jshttp/mime-types) to work with MIME type values. +**Important:** This change affects not only direct usage of `express.static.mime` but also other Express methods that rely on MIME type detection, such as `res.sendFile()`. The following MIME types have changed from Express 4: + +- JavaScript files (.js): now served as "text/javascript" instead of "application/javascript" +- JSON files (.json): now served as "application/json" instead of "text/json" +- CSS files (.css): now served as "text/css" instead of "text/plain" +- HTML files (.html): now served as "text/html; charset=utf-8" instead of just "text/html" +- XML files (.xml): now served as "application/xml" instead of "text/xml" +- Font files (.woff): now served as "font/woff" instead of "application/font-woff" + ```js // v4 express.static.mime.lookup('json')