diff --git a/_data/de/footer.yml b/_data/de/footer.yml index c04d2822d0..7ca317f1bb 100644 --- a/_data/de/footer.yml +++ b/_data/de/footer.yml @@ -3,4 +3,4 @@ privacy_policy: Privacy Policy coc: Code of Conduct trademark_policy: Trademark Policy security_policy: Security Policy -license: Lizenzvertrag \ No newline at end of file +license: Lizenzvertrag diff --git a/_data/de/general.yml b/_data/de/general.yml new file mode 100644 index 0000000000..1ed861c663 --- /dev/null +++ b/_data/de/general.yml @@ -0,0 +1,6 @@ +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' diff --git a/_data/de/menu.yml b/_data/de/menu.yml index 0abd814019..d524e0ace1 100644 --- a/_data/de/menu.yml +++ b/_data/de/menu.yml @@ -1,19 +1,17 @@ # Home home: Home - # Getting started getting_started: Einführung -installing: Installing +installing: Installation hello_world: Hello world generator: Express generator basic_routing: Basisrouting static_files: Statische Dateien examples: More examples faq: Häufig gestellte Fragen - # Guide guide: Leitfaden -routing: Routing +routing: Weiterleitung (Routing) writing_middleware: Middleware schreiben using_middleware: Middleware verwenden overriding_express_api: Overriding the Express API @@ -24,15 +22,12 @@ behind_proxies: Express hinter Proxys migrating_4: Wechsel zu Express 4 migrating_5: Wechsel zu Express 5 database_integration: Datenbankintegration - # API reference - api: API-Referenz 5x: 5.x 4x: 4.x 3x: 3.x (veraltet) 2x: 2.x (veraltet) - # Advanced topics advanced: Themen für Fortgeschrittene developing_template_engines: Template-Engines @@ -40,7 +35,6 @@ security_updates: Sicherheitsupdates best_practice_security: Sicherheitsspezifische Best Practices best_practice_performance: Leistungsspezifische Best Practices healthcheck_graceful_shutdown: Health checks & shutdown - # Resources resources: Ressourcen glossary: Glossar @@ -49,10 +43,8 @@ community: Community utils: Utility modules contributing: Contributing to Express changelog: Release Change Log - # Support support: Support - # Blog blog: Blog latest_post: Latest post diff --git a/_data/es/footer.yml b/_data/es/footer.yml index b768e5f900..420659956c 100644 --- a/_data/es/footer.yml +++ b/_data/es/footer.yml @@ -3,4 +3,4 @@ privacy_policy: Política de privacidad coc: Código de conducta trademark_policy: Política de marcas security_policy: Seguridad -license: Licencia \ No newline at end of file +license: Licencia diff --git a/_data/es/general.yml b/_data/es/general.yml new file mode 100644 index 0000000000..1ed861c663 --- /dev/null +++ b/_data/es/general.yml @@ -0,0 +1,6 @@ +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' diff --git a/_data/es/menu.yml b/_data/es/menu.yml index fbc3e1f781..4e6360588b 100644 --- a/_data/es/menu.yml +++ b/_data/es/menu.yml @@ -1,16 +1,14 @@ # Home home: Inicio - # Getting started getting_started: Cómo empezar -installing: Instalación -hello_world: Hello world -generator: Generador de Express +installing: Instalando +hello_world: Hola mundo +generator: Generador express basic_routing: Direccionamiento básico static_files: Archivos estáticos -examples: More examples -faq: Preguntas más frecuentes - +examples: Más ejemplos +faq: FAQ # Guide guide: Guía routing: Direccionamiento @@ -24,14 +22,12 @@ behind_proxies: Express detrás de proxies migrating_4: Migración a Express 4 migrating_5: Migración a Express 5 database_integration: Integración de la base de datos - # API reference api: Referencia de API 5x: 5.x 4x: 4.x -3x: 3.x (en desuso) -2x: 2.x (en desuso) - +3x: 3.x (obsoleto) +2x: 2.x (obsoleto) # Advanced topics advanced: Temas avanzados developing_template_engines: Motores de plantilla @@ -39,21 +35,18 @@ security_updates: Actualizaciones de seguridad best_practice_security: Mejores prácticas de seguridad best_practice_performance: Mejores prácticas de rendimiento healthcheck_graceful_shutdown: Health checks & shutdown - # Resources resources: Recursos glossary: Glosario middleware: Middleware community: Comunidad utils: Utility modules -contributing: Contributing to Express +contributing: Contribuir a Express changelog: Release Change Log - # Support support: Support - # Blog blog: Blog latest_post: Latest post all_posts: All posts -write_post: Write a Post +write_post: Escribir un post diff --git a/_data/fr/footer.yml b/_data/fr/footer.yml index 6d3291d58c..fe92f52ca8 100644 --- a/_data/fr/footer.yml +++ b/_data/fr/footer.yml @@ -3,4 +3,4 @@ privacy_policy: Privacy Policy coc: Code of Conduct trademark_policy: Trademark Policy security_policy: Security Policy -license: License \ No newline at end of file +license: License diff --git a/_data/fr/general.yml b/_data/fr/general.yml new file mode 100644 index 0000000000..1ed861c663 --- /dev/null +++ b/_data/fr/general.yml @@ -0,0 +1,6 @@ +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' diff --git a/_data/fr/menu.yml b/_data/fr/menu.yml index 6e332938af..e458f9dab5 100644 --- a/_data/fr/menu.yml +++ b/_data/fr/menu.yml @@ -1,16 +1,14 @@ # Home home: Accueil - # Getting started getting_started: Mise en route -installing: Installing +installing: Installation hello_world: Hello world generator: Générateur Express basic_routing: Routage de base static_files: Fichiers statiques examples: More examples faq: FAQ - # Guide guide: Guide routing: Routage @@ -24,15 +22,12 @@ behind_proxies: Express derrière Proxys migrating_4: Migration vers Express 4 migrating_5: Migration vers Express 5 database_integration: Intégration de bases de données - # API reference - api: API reference 5x: 5.x 4x: 4.x 3x: 3.x (obsolète) 2x: 2.x (obsolète) - # Advanced topics advanced: Rubriques avancées developing_template_engines: Moteurs de modèles @@ -40,7 +35,6 @@ security_updates: Mises à jour de sécurité best_practice_security: Meilleures pratiques en termes de sécurité best_practice_performance: Meilleures pratiques en termes de performances healthcheck_graceful_shutdown: Health checks & shutdown - # Resources resources: Ressources glossary: Glossaire @@ -49,10 +43,8 @@ community: Communauté utils: Utility modules contributing: Contributing to Express changelog: Release Change Log - # Support support: Support - # Blog blog: Blog latest_post: Latest post diff --git a/_data/id/footer.yml b/_data/id/footer.yml deleted file mode 100644 index 6d3291d58c..0000000000 --- a/_data/id/footer.yml +++ /dev/null @@ -1,6 +0,0 @@ -terms_of_use: Terms of Use -privacy_policy: Privacy Policy -coc: Code of Conduct -trademark_policy: Trademark Policy -security_policy: Security Policy -license: License \ No newline at end of file diff --git a/_data/id/general.yml b/_data/id/general.yml deleted file mode 100644 index 2903d0067a..0000000000 --- a/_data/id/general.yml +++ /dev/null @@ -1,8 +0,0 @@ -title_announcement: "Express 5.0 documentation is now available." -body_announcement: "The API documentation is a work in progress. For information on what's in the release, see the Express release history" - -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' \ No newline at end of file diff --git a/_data/id/menu.yml b/_data/id/menu.yml deleted file mode 100644 index f7a3a26c82..0000000000 --- a/_data/id/menu.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Home -home: Home - -# Getting started -getting_started: Mulai -installing: Menginstal -hello_world: Hello world -generator: Express generator -basic_routing: Dasar routing -static_files: File statis -examples: Contoh lainnya -faq: FAQ - -# Guide -guide: Panduan -routing: Routing -writing_middleware: Membuat middleware -using_middleware: Menggunakan middleware -overriding_express_api: Mengganti Express API -using_template_engines: Menggunakan template engines -error_handling: Penanganan Error -debugging: Debugging -behind_proxies: Express behind proxies -migrating_4: Pindah to Express 4 -migrating_5: Pindah to Express 5 -database_integration: Integrasi Database - -# API reference - -api: Referensi API -5x: 5.x -4x: 4.x -3x: 3.x (deprecated) -2x: 2.x (deprecated) - -# Advanced topics -advanced: Topik lanjutan -developing_template_engines: Membangun template engines -security_updates: Security updates -best_practice_security: Security best practices -best_practice_performance: Performance best practices -healthcheck_graceful_shutdown: Health checks & shutdown - -# Resources -resources: Resources -glossary: Glossary -middleware: Middleware -community: Community -utils: Utility modules -contributing: Contributing to Express -changelog: Release Change Log - -# Support -support: Support - -# Blog -blog: Blog -latest_post: Latest post -all_posts: All posts -write_post: Write a Post diff --git a/_data/it/footer.yml b/_data/it/footer.yml index 6d3291d58c..fe92f52ca8 100644 --- a/_data/it/footer.yml +++ b/_data/it/footer.yml @@ -3,4 +3,4 @@ privacy_policy: Privacy Policy coc: Code of Conduct trademark_policy: Trademark Policy security_policy: Security Policy -license: License \ No newline at end of file +license: License diff --git a/_data/it/general.yml b/_data/it/general.yml new file mode 100644 index 0000000000..1ed861c663 --- /dev/null +++ b/_data/it/general.yml @@ -0,0 +1,6 @@ +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' diff --git a/_data/it/menu.yml b/_data/it/menu.yml index b8a5fbb6e0..38544bad5a 100644 --- a/_data/it/menu.yml +++ b/_data/it/menu.yml @@ -1,6 +1,5 @@ # Home home: Home - # Getting started getting_started: Introduzione installing: Installazione @@ -10,7 +9,6 @@ basic_routing: Routing di base static_files: File statici examples: More examples faq: FAQ - # Guide guide: Guide routing: Routing @@ -24,15 +22,12 @@ behind_proxies: Express con i proxy migrating_4: Passaggio a Express 4 migrating_5: Passaggio a Express 5 database_integration: Integrazione database - # API reference - api: Riferimento API 5x: 5.x 4x: 4.x 3x: 3.x (deprecato) 2x: 2.x (deprecato) - # Advanced topics advanced: Argomenti avanzati developing_template_engines: Motori di template @@ -40,19 +35,16 @@ security_updates: Aggiornamenti sulla sicurezza best_practice_security: Best practice sulla sicurezza best_practice_performance: Best practice sulle prestazioni healthcheck_graceful_shutdown: Health checks & shutdown - # Resources resources: Risorse -glossary: Glossary +glossary: Glossario middleware: Middleware community: Community utils: Utility modules contributing: Contributing to Express changelog: Release Change Log - # Support support: Support - # Blog blog: Blog latest_post: Latest post diff --git a/_data/ja/footer.yml b/_data/ja/footer.yml index 6d3291d58c..fe92f52ca8 100644 --- a/_data/ja/footer.yml +++ b/_data/ja/footer.yml @@ -3,4 +3,4 @@ privacy_policy: Privacy Policy coc: Code of Conduct trademark_policy: Trademark Policy security_policy: Security Policy -license: License \ No newline at end of file +license: License diff --git a/_data/ja/general.yml b/_data/ja/general.yml new file mode 100644 index 0000000000..1ed861c663 --- /dev/null +++ b/_data/ja/general.yml @@ -0,0 +1,6 @@ +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' diff --git a/_data/ja/menu.yml b/_data/ja/menu.yml index 9ceef0ced8..2eee50b2a4 100644 --- a/_data/ja/menu.yml +++ b/_data/ja/menu.yml @@ -1,6 +1,5 @@ # Home home: ホーム - # Getting started getting_started: 概説 installing: インストール @@ -10,7 +9,6 @@ basic_routing: 基本的なルーティング static_files: 静的ファイル examples: More examples faq: FAQ - # Guide guide: ガイド routing: ルーティング @@ -24,15 +22,12 @@ behind_proxies: プロキシーの背後の Express migrating_4: Express 4 への移行 migrating_5: Express 5 への移行 database_integration: データベースの統合 - # API reference - api: API リファレンス 5x: 5.x 4x: 4.x 3x: 3.x (非推奨) 2x: 2.x (非推奨) - # Advanced topics advanced: 高度なトピック developing_template_engines: テンプレート・エンジン @@ -40,7 +35,6 @@ security_updates: セキュリティー更新 best_practice_security: セキュリティーに関するベスト・プラクティス best_practice_performance: パフォーマンスに関するベスト・プラクティス healthcheck_graceful_shutdown: Health checks & shutdown - # Resources resources: リソース glossary: 用語集 @@ -49,10 +43,8 @@ community: コミュニティー utils: Utility modules contributing: Contributing to Express changelog: Release Change Log - # Support support: Support - # Blog blog: Blog latest_post: Latest post diff --git a/_data/ko/footer.yml b/_data/ko/footer.yml index 6d3291d58c..fe92f52ca8 100644 --- a/_data/ko/footer.yml +++ b/_data/ko/footer.yml @@ -3,4 +3,4 @@ privacy_policy: Privacy Policy coc: Code of Conduct trademark_policy: Trademark Policy security_policy: Security Policy -license: License \ No newline at end of file +license: License diff --git a/_data/ko/general.yml b/_data/ko/general.yml index 2903d0067a..1ed861c663 100644 --- a/_data/ko/general.yml +++ b/_data/ko/general.yml @@ -1,8 +1,6 @@ -title_announcement: "Express 5.0 documentation is now available." -body_announcement: "The API documentation is a work in progress. For information on what's in the release, see the Express release history" - +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' \ No newline at end of file +caution: 'Caution' diff --git a/_data/ko/menu.yml b/_data/ko/menu.yml index b8ecb43be9..7bef82a1e8 100644 --- a/_data/ko/menu.yml +++ b/_data/ko/menu.yml @@ -1,6 +1,5 @@ # Home home: 홈 - # Getting started getting_started: 시작하기 installing: 설치 @@ -10,9 +9,8 @@ basic_routing: 기본 라우팅 static_files: 정적 파일 examples: More examples faq: 자주 묻는 질문(FAQ) - # Guide -guide: 안내서 +guide: Gu안내서ide routing: 라우팅 writing_middleware: 미들웨어 작성 using_middleware: 미들웨어 사용 @@ -24,15 +22,12 @@ behind_proxies: 프록시 환경에서 Express 사용 migrating_4: Express 4로의 이전 migrating_5: Express 5로의 이전 database_integration: 데이터베이스 통합 - # API reference - api: API 참조 5x: 5.x 4x: 4.x 3x: 3.x(더 이상 사용되지 않음) 2x: 2.x(더 이상 사용되지 않음) - # Advanced topics advanced: 고급 주제 developing_template_engines: 템플리트 엔진 @@ -40,7 +35,6 @@ security_updates: 보안 업데이트 best_practice_security: 보안 우수 사례 best_practice_performance: 성능 우수 사례 healthcheck_graceful_shutdown: Health checks & shutdown - # Resources resources: 자원 glossary: 용어집 @@ -49,10 +43,8 @@ community: 커뮤니티 utils: Utility modules contributing: Contributing to Express changelog: Release Change Log - # Support support: Support - # Blog blog: Blog latest_post: Latest post diff --git a/_data/languages.yml b/_data/languages.yml index 2cdb04c252..8d3055553f 100644 --- a/_data/languages.yml +++ b/_data/languages.yml @@ -10,8 +10,6 @@ name: Italiano - code: ja name: 日本語 -- code: ru - name: Русский - code: zh-cn name: 中文 (简体) - code: zh-tw @@ -19,16 +17,4 @@ - code: ko name: 한국어 - code: pt-br - name: Português -- code: sk - name: Slovenčina -- code: uk - name: Українська -- code: uz - name: Oʻzbekcha -- code: tr - name: Türkçe -- code: th - name: ภาษาไทย -- code: id - name: Indonesia \ No newline at end of file + name: Português \ No newline at end of file diff --git a/_data/pt-br/footer.yml b/_data/pt-br/footer.yml index 5db69348bf..333dfebf6e 100644 --- a/_data/pt-br/footer.yml +++ b/_data/pt-br/footer.yml @@ -3,4 +3,4 @@ privacy_policy: Política de Privacidade coc: Código de Conduta trademark_policy: Política de Marcas security_policy: Política de Segurança -license: Licença \ No newline at end of file +license: Licença diff --git a/_data/pt-br/general.yml b/_data/pt-br/general.yml index 2903d0067a..1ed861c663 100644 --- a/_data/pt-br/general.yml +++ b/_data/pt-br/general.yml @@ -1,8 +1,6 @@ -title_announcement: "Express 5.0 documentation is now available." -body_announcement: "The API documentation is a work in progress. For information on what's in the release, see the Express release history" - +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' \ No newline at end of file +caution: 'Caution' diff --git a/_data/pt-br/menu.yml b/_data/pt-br/menu.yml index 4b6d49b40b..c481f58273 100644 --- a/_data/pt-br/menu.yml +++ b/_data/pt-br/menu.yml @@ -1,6 +1,5 @@ # Home home: Página Inicial - # Getting started getting_started: Introdução installing: Instalação @@ -9,8 +8,7 @@ generator: Gerador do Express basic_routing: Roteamento Básico static_files: Arquivos Estáticos examples: Perguntas mais frequentes -faq: FAQ - +faq: Perguntas mais frequentes # Guide guide: Guide routing: Roteamento @@ -24,15 +22,12 @@ behind_proxies: Express atrás de proxies migrating_4: Migrando para o Express 4 migrating_5: Migrando para o Express 5 database_integration: Integração de Banco de dados - # API reference - api: Referência da API 5x: 5.x 4x: 4.x 3x: 3.x (descontinuada) 2x: 2.x (descontinuada) - # Advanced topics advanced: Tópicos Avançados developing_template_engines: Mecanismos de modelo @@ -40,7 +35,6 @@ security_updates: Atualizações de segurança best_practice_security: Melhores práticas de segurança best_practice_performance: Melhores práticas de desempenho healthcheck_graceful_shutdown: Health checks & shutdown - # Resources resources: Recursos glossary: Glossário @@ -49,10 +43,8 @@ community: Comunidade utils: Utility modules contributing: Contributing to Express changelog: Release Change Log - # Support support: Suporte - # Blog blog: Blog latest_post: Ultimos post diff --git a/_data/ru/footer.yml b/_data/ru/footer.yml deleted file mode 100644 index 6d3291d58c..0000000000 --- a/_data/ru/footer.yml +++ /dev/null @@ -1,6 +0,0 @@ -terms_of_use: Terms of Use -privacy_policy: Privacy Policy -coc: Code of Conduct -trademark_policy: Trademark Policy -security_policy: Security Policy -license: License \ No newline at end of file diff --git a/_data/ru/menu.yml b/_data/ru/menu.yml deleted file mode 100644 index 7425ab4483..0000000000 --- a/_data/ru/menu.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Home -home: Главная - -# Getting started -getting_started: Начало работы -installing: Установка -hello_world: Hello world -generator: Генератор приложений Express -basic_routing: Основы маршрутизации -static_files: Статические файлы -examples: More examples -faq: FAQ - -# Guide -guide: Руководство -routing: Маршрутизация -writing_middleware: Написание кода промежуточных обработчиков -using_middleware: Использование промежуточных обработчиков -overriding_express_api: Overriding the Express API -using_template_engines: Использование шаблонизаторов -error_handling: Обработка ошибок -debugging: Отладка -behind_proxies: Express за прокси -migrating_4: Переход к Express 4 -migrating_5: Переход к Express 5 -database_integration: Интеграция с базами данных - -# API reference - -api: API -5x: 5.x -4x: 4.x -3x: 3.x (устарел) -2x: 2.x (устарел) - -# Advanced topics -advanced: Расширенные возможности -developing_template_engines: Шаблонизаторы -security_updates: Обновления системы безопасности -best_practice_security: Лучшие практические методы в области защиты -best_practice_performance: Лучшие практические методы улучшения производительности -healthcheck_graceful_shutdown: Health checks & shutdown - -# Resources -resources: Ресурсы -glossary: Глоссарий -middleware: Промежуточный обработчик -community: Сообщество -utils: Utility modules -contributing: Contributing to Express -changelog: Release Change Log - -# Support -support: Support - -# Blog -blog: Blog -latest_post: Latest post -all_posts: All posts -write_post: Write a Post diff --git a/_data/sk/footer.yml b/_data/sk/footer.yml deleted file mode 100644 index 6d3291d58c..0000000000 --- a/_data/sk/footer.yml +++ /dev/null @@ -1,6 +0,0 @@ -terms_of_use: Terms of Use -privacy_policy: Privacy Policy -coc: Code of Conduct -trademark_policy: Trademark Policy -security_policy: Security Policy -license: License \ No newline at end of file diff --git a/_data/sk/menu.yml b/_data/sk/menu.yml deleted file mode 100644 index 91663f754a..0000000000 --- a/_data/sk/menu.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Home -home: Domov - -# Getting started -getting_started: Začíname -installing: Inštalácia -hello_world: Hello world -generator: Express generátor -basic_routing: Základný routing -static_files: Statické súbory -examples: More examples -faq: FAQ - -# Guide -guide: Príručka -routing: Routing -writing_middleware: Tvorba middleware -using_middleware: Použitie middleware -overriding_express_api: Overriding the Express API -using_template_engines: Použitie template enginov -error_handling: Error handling -debugging: Debuggovanie -behind_proxies: Použitie Express za proxy -migrating_4: Prechod na Express 4 -migrating_5: Prechod na Express 5 -database_integration: Integrácia s databázou - -# API reference - -api: API referenčná príručka -5x: 5.x -4x: 4.x -3x: 3.x (zastaralé) -2x: 2.x (zastaralé) - -# Advanced topics -advanced: Pokročilé témy -developing_template_engines: Templatovacie enginy -security_updates: Security - aktualizácie -best_practice_security: Security - osvedčené postupy -best_practice_performance: Výkonnosť - osvedčené postupy -healthcheck_graceful_shutdown: Health checks & shutdown - -# Resources -resources: Zdroje -glossary: Glosár -middleware: Middleware -community: Komunita -utils: Utility modules -contributing: Contributing to Express -changelog: Release Change Log - -# Support -support: Support - -# Blog -blog: Blog -latest_post: Latest post -all_posts: All posts -write_post: Write a Post diff --git a/_data/th/footer.yml b/_data/th/footer.yml deleted file mode 100644 index 6d3291d58c..0000000000 --- a/_data/th/footer.yml +++ /dev/null @@ -1,6 +0,0 @@ -terms_of_use: Terms of Use -privacy_policy: Privacy Policy -coc: Code of Conduct -trademark_policy: Trademark Policy -security_policy: Security Policy -license: License \ No newline at end of file diff --git a/_data/th/menu.yml b/_data/th/menu.yml deleted file mode 100644 index 3cd7351d0b..0000000000 --- a/_data/th/menu.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Home -home: หน้าแรก - -# Getting started -getting_started: หน้าแรก -installing: การติดตั้ง -hello_world: Hello world -generator: เครื่องมือสร้าง Express -basic_routing: เส้นทางเบื้องต้น -static_files: บริการไฟล์คงที่ -examples: More examples -faq: คำถามที่พบบ่อย - -# Guide -guide: แนะนำ -routing: การใช้งานเราเตอร์ -writing_middleware: การเขียนมิดเดิลแวร์ -using_middleware: การใช้งานมิดเดิลแวร์ -overriding_express_api: Overriding the Express API -using_template_engines: การใช้งานเครื่องสร้างโครงแบบ -error_handling: การจักการความผิดพลาด -debugging: การแก้จุดบกพร่อง -behind_proxies: Express เบื่องหลังพร็อกซี -migrating_4: การย้ายไป Express 4 -migrating_5: การย้ายไป Express 5 -database_integration: การเชื่อมโยงกับฐานข้อมูล - -# API reference - -api: การอ้างอิง API -5x: 5.x -4x: 4.x -3x: 3.x (เลิกใช้) -2x: 2.x (เลิกใช้) - -# Advanced topics -advanced: หัวข้อขั้นสูง -developing_template_engines: เครื่องสร้างโครงแบบ -security_updates: ความปลอดภัยล่าสุด -best_practice_security: แนวทางปฏิบัติความปลอดภัย -best_practice_performance: แนวทางปฏิบัติประสิทธิภาพ -healthcheck_graceful_shutdown: Health checks & shutdown - -# Resources -resources: แหล่งข้อมูลอื่น -glossary: ศัพย์ -middleware: มิลเดิลแวร์ -community: ชุมชน -utils: โมดูลที่มีประโยชน์ -contributing: มีส่วนร่วมกับ Express -changelog: บันทึกการเปลี่ยนแปลง - -# Support -support: Support - -# Blog -blog: Blog -latest_post: Latest post -all_posts: All posts -write_post: Write a Post diff --git a/_data/tr/footer.yml b/_data/tr/footer.yml deleted file mode 100644 index 6d3291d58c..0000000000 --- a/_data/tr/footer.yml +++ /dev/null @@ -1,6 +0,0 @@ -terms_of_use: Terms of Use -privacy_policy: Privacy Policy -coc: Code of Conduct -trademark_policy: Trademark Policy -security_policy: Security Policy -license: License \ No newline at end of file diff --git a/_data/tr/menu.yml b/_data/tr/menu.yml deleted file mode 100644 index 9ea41be059..0000000000 --- a/_data/tr/menu.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Home -home: Anasayfa - -# Getting started -getting_started: Buradan Başlayın -installing: Kurulum -hello_world: Merhaba Dünya -generator: Express Oluşturucu -basic_routing: Basit Yönlendirme -static_files: Statik Dosyalar -examples: More examples -faq: SSS - -# Guide -guide: Kılavuz -routing: Yönlendirme -writing_middleware: Middleware yazma -using_middleware: Şablon motoru kullanma -overriding_express_api: Overriding the Express API -using_template_engines: Hata işleme -error_handling: Hata işleme -debugging: Hata Ayıklama -behind_proxies: Express behind proxies -migrating_4: Express 4 geçiş -migrating_5: Express 5 geçiş -database_integration: Database Entegrasyonu - -# API reference - -api: API Kaynak -5x: 5.x -4x: 4.x -3x: 3.x (Kullanımdan kaldırıldı) -2x: 2.x (Kullanımdan kaldırıldı) - -# Advanced topics -advanced: Gelişmiş konular -developing_template_engines: Şablon motorları -security_updates: Gğvenlik güncellemeleri -best_practice_security: En iyi güvenlik uygulamaları -best_practice_performance: En iyi performans uygulamaları -healthcheck_graceful_shutdown: Health checks & shutdown - -# Resources -resources: Kaynaklar -glossary: Terimler -middleware: Middleware -community: Topluluk -utils: Yardımcı Modüller -contributing: Express'e katkıda bulunmak -changelog: Sürüm Notları - -# Support -support: Support - -# Blog -blog: Blog -latest_post: Latest post -all_posts: All posts -write_post: Write a Post diff --git a/_data/uk/footer.yml b/_data/uk/footer.yml deleted file mode 100644 index 6d3291d58c..0000000000 --- a/_data/uk/footer.yml +++ /dev/null @@ -1,6 +0,0 @@ -terms_of_use: Terms of Use -privacy_policy: Privacy Policy -coc: Code of Conduct -trademark_policy: Trademark Policy -security_policy: Security Policy -license: License \ No newline at end of file diff --git a/_data/uk/general.yml b/_data/uk/general.yml deleted file mode 100644 index 2903d0067a..0000000000 --- a/_data/uk/general.yml +++ /dev/null @@ -1,8 +0,0 @@ -title_announcement: "Express 5.0 documentation is now available." -body_announcement: "The API documentation is a work in progress. For information on what's in the release, see the Express release history" - -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' \ No newline at end of file diff --git a/_data/uk/menu.yml b/_data/uk/menu.yml deleted file mode 100644 index 2185f01523..0000000000 --- a/_data/uk/menu.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Home -home: Початкова сторінка - -# Getting started -getting_started: Ознайомлення -installing: Встановлення -hello_world: Hello world -generator: Генератор структури Express -basic_routing: Базова маршрутизація -static_files: Статичні файли -examples: More examples -faq: ЧАПи - -# Guide -guide: Гід -routing: Маршрутизація -writing_middleware: Створення проміжних обробників -using_middleware: Використання проміжних обробників -overriding_express_api: Overriding the Express API -using_template_engines: Використання шаблонізаторів -error_handling: Обробка помилок -debugging: Зневадження -behind_proxies: Express позаду проксі -migrating_4: Перехід на Express 4 -migrating_5: Перехід на Express 5 -database_integration: Інтеграція з базами даних - -# API reference - -api: Довідник API -5x: 5.x -4x: 4.x -3x: 3.x (застаріла) -2x: 2.x (застаріла) - -# Advanced topics -advanced: Додаткові можливості -developing_template_engines: Шаблонізатори -security_updates: Оновлення безпеки -best_practice_security: Кращі практики безпеки -best_practice_performance: Кращі практики продуктивності -healthcheck_graceful_shutdown: Health checks & shutdown - -# Resources -resources: Ресурси -glossary: Голосарій -middleware: Проміжний обробник -community: Спільнота -utils: Utility modules -contributing: Contributing to Express -changelog: Release Change Log - -# Support -support: Support - -# Blog -blog: Blog -latest_post: Latest post -all_posts: All posts -write_post: Write a Post diff --git a/_data/uz/footer.yml b/_data/uz/footer.yml deleted file mode 100644 index 6d3291d58c..0000000000 --- a/_data/uz/footer.yml +++ /dev/null @@ -1,6 +0,0 @@ -terms_of_use: Terms of Use -privacy_policy: Privacy Policy -coc: Code of Conduct -trademark_policy: Trademark Policy -security_policy: Security Policy -license: License \ No newline at end of file diff --git a/_data/uz/menu.yml b/_data/uz/menu.yml deleted file mode 100644 index 85bb14a768..0000000000 --- a/_data/uz/menu.yml +++ /dev/null @@ -1,60 +0,0 @@ -# Home -home: Bosh sahifa - -# Getting started -getting_started: Boshlang'ich ishlar -installing: O'rnatish -hello_world: Hello world -generator: Express generator -basic_routing: Oddiy routing -static_files: Statik fayllar -examples: More examples -faq: FAQ - -# Guide -guide: Qo'llanma -routing: Routing -writing_middleware: Middleware yozish -using_middleware: Middleware ishlatish -overriding_express_api: Overriding the Express API -using_template_engines: Template engine ishlatish -error_handling: Xatolarni qayta ishlash -debugging: Debug qilish -behind_proxies: Express proksilar bilan -migrating_4: Express 4ga o'tish -migrating_5: Express 5ga o'tish -database_integration: Ma'lumotlar omboriga ulash - -# API reference - -api: API qo'llanma -5x: 5.x -4x: 4.x -3x: 3.x (eskirgan) -2x: 2.x (eskirgan) - -# Advanced topics -advanced: Advanced topics -developing_template_engines: Building template engines -security_updates: Security updates -best_practice_security: Security best practices -best_practice_performance: Performance best practices -healthcheck_graceful_shutdown: Health checks & shutdown - -# Resources -resources: Resources -glossary: Glossary -middleware: Middleware -community: Community -utils: Utility modules -contributing: Contributing to Express -changelog: Release Change Log - -# Support -support: Support - -# Blog -blog: Blog -latest_post: Latest post -all_posts: All posts -write_post: Write a Post diff --git a/_data/zh-cn/footer.yml b/_data/zh-cn/footer.yml index 6d3291d58c..fe92f52ca8 100644 --- a/_data/zh-cn/footer.yml +++ b/_data/zh-cn/footer.yml @@ -3,4 +3,4 @@ privacy_policy: Privacy Policy coc: Code of Conduct trademark_policy: Trademark Policy security_policy: Security Policy -license: License \ No newline at end of file +license: License diff --git a/_data/zh-cn/general.yml b/_data/zh-cn/general.yml new file mode 100644 index 0000000000..1ed861c663 --- /dev/null +++ b/_data/zh-cn/general.yml @@ -0,0 +1,6 @@ +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' diff --git a/_data/zh-cn/menu.yml b/_data/zh-cn/menu.yml index cb569aa801..c0fe7b7a8c 100644 --- a/_data/zh-cn/menu.yml +++ b/_data/zh-cn/menu.yml @@ -1,6 +1,5 @@ # Home home: 主页 - # Getting started getting_started: 入门 installing: 安装 @@ -10,7 +9,6 @@ basic_routing: 基本路由 static_files: 静态文件 examples: More examples faq: 常见问题及解答 - # Guide guide: 指南 routing: 路由 @@ -24,15 +22,12 @@ behind_proxies: 代理背后的 Express migrating_4: 迁移到 Express 4 migrating_5: 迁移到 Express 5 database_integration: 数据库集成 - # API reference - api: API 参考 5x: 5.x 4x: 4.x 3x: 3.x (不推荐) 2x: 2.x (不推荐) - # Advanced topics advanced: 高级主题 developing_template_engines: 模板引擎 @@ -40,7 +35,6 @@ security_updates: 安全更新 best_practice_security: 安全最佳实践 best_practice_performance: 性能最佳实践 healthcheck_graceful_shutdown: Health checks & shutdown - # Resources resources: 资源 glossary: 词汇表 @@ -49,10 +43,8 @@ community: 社区 utils: Utility modules contributing: Contributing to Express changelog: Release Change Log - # Support support: Support - # Blog blog: Blog latest_post: Latest post diff --git a/_data/zh-tw/footer.yml b/_data/zh-tw/footer.yml index 6d3291d58c..fe92f52ca8 100644 --- a/_data/zh-tw/footer.yml +++ b/_data/zh-tw/footer.yml @@ -3,4 +3,4 @@ privacy_policy: Privacy Policy coc: Code of Conduct trademark_policy: Trademark Policy security_policy: Security Policy -license: License \ No newline at end of file +license: License diff --git a/_data/zh-tw/general.yml b/_data/zh-tw/general.yml new file mode 100644 index 0000000000..1ed861c663 --- /dev/null +++ b/_data/zh-tw/general.yml @@ -0,0 +1,6 @@ +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' diff --git a/_data/zh-tw/menu.yml b/_data/zh-tw/menu.yml index bf2f92add8..14fdb2afa2 100644 --- a/_data/zh-tw/menu.yml +++ b/_data/zh-tw/menu.yml @@ -1,6 +1,5 @@ # Home home: 首頁 - # Getting started getting_started: 入門 installing: 安裝 @@ -10,7 +9,6 @@ basic_routing: 基本路由 static_files: 靜態檔案 examples: More examples faq: 常見問題 (FAQ) - # Guide guide: 手冊 routing: 路由 @@ -24,15 +22,12 @@ behind_proxies: 位於 Proxy 背後的 Express migrating_4: 移至 Express 4 migrating_5: 移至 Express 5 database_integration: 資料庫整合 - # API reference - api: API 參照 5x: 5.x 4x: 4.x 3x: 3.x 已淘汰 2x: 2.x (已淘汰) - # Advanced topics advanced: 進階主題 developing_template_engines: 範本引擎 @@ -40,7 +35,6 @@ security_updates: 安全更新 best_practice_security: 安全最佳作法 best_practice_performance: 效能最佳作法 healthcheck_graceful_shutdown: Health checks & shutdown - # Resources resources: 資源 glossary: 名詞解釋 @@ -49,10 +43,8 @@ community: 社群 utils: Utility modules contributing: Contributing to Express changelog: Release Change Log - # Support support: Support - # Blog blog: Blog latest_post: Latest post diff --git a/de/3x/api.md b/de/3x/api.md old mode 100755 new mode 100644 index 9315550841..de6a67412f --- a/de/3x/api.md +++ b/de/3x/api.md @@ -1,33 +1,26 @@ --- -layout: 3x-api +layout: api +version: 3x title: Express 3.x - API-Referenz 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. -menu: api lang: de +redirect_from: " " --- +
Typ | Wert | |
---|---|---|
Boolesch | --Wenn `true` angegeben wird, wird die IP-Adresse des Clients als der äußerst rechte Eintrag im Header `X-Forwarded-*` interpretiert. + | Wenn `true` angegeben wird, wird die IP-Adresse des Clients als der äußerst rechte Eintrag im Header `X-Forwarded-*` interpretiert.
+
Wenn `false` angegeben wird, wird die Anwendung als direkte Verbindung zum Internet gesehen. Die IP-Adresse des Clients wird dann von `req.connection.remoteAddress` abgeleitet. Dies ist die Standardeinstellung.
+
+
+When setting to `true`, it is important to ensure that the last reverse proxy trusted is removing/overwriting all of the following HTTP headers: `X-Forwarded-For`, `X-Forwarded-Host`, and `X-Forwarded-Proto`, otherwise it may be possible for the client to provide any value.
+
|
IP-Adressen | +IP addresses | -Eine einzelne IP-Adresse, ein Teilnetz oder ein Array von IP-Adressen und Teilnetzen, denen vertraut werden kann. Die folgende Liste zeigt die vorkonfigurierten Teilnetznamen: -* loopback - `127.0.0.1/8`, `::1/128` -* linklocal - `169.254.0.0/16`, `fe80::/10` -* uniquelocal - `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `fc00::/7`. +An IP address, subnet, or an array of IP addresses and subnets to trust as being a reverse proxy. The following list shows the pre-configured subnet names: + +- loopback - `127.0.0.1/8`, `::1/128` +- linklocal - `169.254.0.0/16`, `fe80::/10` +- uniquelocal - `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `fc00::/7` Sie können IP-Adressen wie folgt festlegen: @@ -41,19 +49,24 @@ app.set('trust proxy', 'loopback, linklocal, uniquelocal') // specify multiple s app.set('trust proxy', ['loopback', 'linklocal', 'uniquelocal']) // specify multiple subnets as an array ``` -Sobald die Werte angegeben wurden, werden die betreffenden IP-Adressen und Teilnetze aus dem Adressfeststellungsprozess ausgeschlossen. Die nicht vertrauenswürdige IP-Adresse, die am nächsten zum Anwendungsserver liegt, wird als IP-Adresse des Clients festgelegt. +Sobald die Werte angegeben wurden, werden die betreffenden IP-Adressen und Teilnetze aus dem Adressfeststellungsprozess ausgeschlossen. Die nicht vertrauenswürdige IP-Adresse, die am nächsten zum Anwendungsserver liegt, wird als IP-Adresse des Clients festgelegt. This works by checking if `req.socket.remoteAddress` is trusted. If so, then each address in `X-Forwarded-For` is checked from right to left until the first non-trusted address. + |
Zahl |
-Dem `n`-ten Hop vom Proxy-Server soll als Client vertraut werden.
+Use the address that is at most `n` number of hops away from the Express application. `req.socket.remoteAddress` is the first hop, and the rest are looked for in the `X-Forwarded-For` header from right to left. A value of `0` means that the first untrusted address would be `req.socket.remoteAddress`, i.e. there is no reverse proxy.
+
+
+When using this setting, it is important to ensure there are not multiple, different-length paths to the Express application such that the client can be less than the configured number of hops away, otherwise it may be possible for the client to provide any value.
+
|
|
Funktion | +Function | -Individuell angepasste, vertrauenswürdige Implementierung. Dies sollten Sie nur verwenden, wenn Sie genau wissen, was Sie tun. +Custom trust implementation. ```js app.set('trust proxy', (ip) => { @@ -61,16 +74,16 @@ app.set('trust proxy', (ip) => { else return false }) ``` + |
-
-var cassandra = require('cassandra-driver');
-var client = new cassandra.Client({ contactPoints: ['localhost']});
+```bash
+$ npm install couchbase
+```
-client.execute('select key from system.local', function(err, result) {
- if (err) throw err;
- console.log(result.rows[0]);
-});
-
-
+### Beispiel
-
+```js
+const couchbase = require('couchbase')
+const bucket = (new couchbase.Cluster('http://localhost:8091')).openBucket('bucketName')
+
+// add a document to a bucket
+bucket.insert('document-key', { name: 'Matt', shoeSize: 13 }, (err, result) => {
+ if (err) {
+ console.log(err)
+ } else {
+ console.log(result)
+ }
+})
+
+// get all documents with shoe size 13
+const n1ql = 'SELECT d.* FROM `bucketName` d WHERE shoeSize = $1'
+const query = N1qlQuery.fromString(n1ql)
+bucket.query(query, [13], (err, result) => {
+ if (err) {
+ console.log(err)
+ } else {
+ console.log(result)
+ }
+})
+```
## CouchDB
**Modul**: [nano](https://github.com/dscape/nano)
**Installation**
+### Installation
+
```bash
$ npm install nano
```
-**Beispiel**
+### Beispiel
-
-
-var nano = require('nano')('http://localhost:5984');
-nano.db.create('books');
-var books = nano.db.use('books');
+```js
+const nano = require('nano')('http://localhost:5984')
+nano.db.create('books')
+const books = nano.db.use('books')
-//Insert a book document in the books database
-books.insert({name: 'The Art of war'}, null, function(err, body) {
- if (!err){
- console.log(body);
+// Insert a book document in the books database
+books.insert({ name: 'The Art of war' }, null, (err, body) => {
+ if (err) {
+ console.log(err)
+ } else {
+ console.log(body)
}
-});
+})
-//Get a list of all books
-books.list(function(err, body){
- console.log(body.rows);
-});
-
-
-
-
+// Get a list of all books
+books.list((err, body) => {
+ if (err) {
+ console.log(err)
+ } else {
+ console.log(body.rows)
+ }
+})
+```
## LevelDB
**Modul**: [levelup](https://github.com/rvagg/node-levelup)
**Installation**
+### Installation
+
```bash
$ npm install level levelup leveldown
```
-**Beispiel**
-
-
-
-var levelup = require('levelup');
-var db = levelup('./mydb');
+### Beispiel
-db.put('name', 'LevelUP', function (err) {
+```js
+const levelup = require('levelup')
+const db = levelup('./mydb')
- if (err) return console.log('Ooops!', err);
- db.get('name', function (err, value) {
- if (err) return console.log('Ooops!', err);
- console.log('name=' + value);
- });
+db.put('name', 'LevelUP', (err) => {
+ if (err) return console.log('Ooops!', err)
-});
-
-
+ db.get('name', (err, value) => {
+ if (err) return console.log('Ooops!', err)
-
+ console.log(`name=${value}`)
+ })
+})
+```
## MySQL
**Modul**: [mysql](https://github.com/felixge/node-mysql/)
**Installation**
+### Installation
+
```bash
$ npm install mysql
```
-**Beispiel**
+### Beispiel
-
-
-var mysql = require('mysql');
-var connection = mysql.createConnection({
- host : 'localhost',
- user : 'dbuser',
- password : 's3kreee7'
-});
+```js
+const mysql = require('mysql')
+const connection = mysql.createConnection({
+ host: 'localhost',
+ user: 'dbuser',
+ password: 's3kreee7',
+ database: 'my_db'
+})
-connection.connect();
+connection.connect()
-connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
- if (err) throw err;
- console.log('The solution is: ', rows[0].solution);
-});
+connection.query('SELECT 1 + 1 AS solution', (err, rows, fields) => {
+ if (err) throw err
-connection.end();
-
-
+ console.log('The solution is: ', rows[0].solution)
+})
-
+connection.end()
+```
## MongoDB
**Modul**: [mongodb](https://github.com/mongodb/node-mongodb-native)
**Installation**
+### Installation
+
```bash
$ npm install mongodb
```
-**Beispiel**
+### Example (v2.\*)
-
-
-var MongoClient = require('mongodb').MongoClient;
+```js
+const MongoClient = require('mongodb').MongoClient
-MongoClient.connect('mongodb://localhost:27017/animals', function(err, db) {
- if (err) {
- throw err;
- }
- db.collection('mammals').find().toArray(function(err, result) {
- if (err) {
- throw err;
- }
- console.log(result);
- });
-});
-
-
+MongoClient.connect('mongodb://localhost:27017/animals', (err, db) => {
+ if (err) throw err
-Wenn Sie nach einem Objektmodelltreiber für MongoDB suchen, schauen Sie unter [Mongoose](https://github.com/LearnBoost/mongoose) nach.
+ db.collection('mammals').find().toArray((err, result) => {
+ if (err) throw err
-
+ console.log(result)
+ })
+})
+```
+
+### Example (v3.\*)
+
+```js
+const MongoClient = require('mongodb').MongoClient
+
+MongoClient.connect('mongodb://localhost:27017/animals', (err, client) => {
+ if (err) throw err
+
+ const db = client.db('animals')
+
+ db.collection('mammals').find().toArray((err, result) => {
+ if (err) throw err
+
+ console.log(result)
+ })
+})
+```
+
+Wenn Sie nach einem Objektmodelltreiber für MongoDB suchen, schauen Sie unter [Mongoose](https://github.com/LearnBoost/mongoose) nach.
## Neo4j
-**Modul**: [apoc](https://github.com/hacksparrow/apoc)
-**Installation**
+**Module**: [neo4j-driver](https://github.com/neo4j/neo4j-javascript-driver)
+
+### Installation
```bash
-$ npm install apoc
+$ npm install neo4j-driver
```
-**Beispiel**
+### Beispiel
-
-
-var apoc = require('apoc');
+```js
+const neo4j = require('neo4j-driver')
+const driver = neo4j.driver('neo4j://localhost:7687', neo4j.auth.basic('neo4j', 'letmein'))
-apoc.query('match (n) return n').exec().then(
- function (response) {
- console.log(response);
- },
- function (fail) {
- console.log(fail);
- }
-);
-
-
+const session = driver.session()
-
+session.readTransaction((tx) => {
+ return tx.run('MATCH (n) RETURN count(n) AS count')
+ .then((res) => {
+ console.log(res.records[0].get('count'))
+ })
+ .catch((error) => {
+ console.log(error)
+ })
+})
+```
## Oracle
@@ -256,129 +309,182 @@ async function getEmployee (empId) {
getEmployee(101)
```
-
-
## PostgreSQL
**Modul**: [pg-promise](https://github.com/vitaly-t/pg-promise)
**Installation**
+### Installation
+
```bash
$ npm install pg-promise
```
-**Beispiel**
-
-
-
-var pgp = require("pg-promise")(/*options*/);
-var db = pgp("postgres://username:password@host:port/database");
-
-db.one("SELECT $1 AS value", 123)
- .then(function (data) {
- console.log("DATA:", data.value);
- })
- .catch(function (error) {
- console.log("ERROR:", error);
- });
-
-
+### Beispiel
-
+```js
+const pgp = require('pg-promise')(/* options */)
+const db = pgp('postgres://username:password@host:port/database')
+
+db.one('SELECT $1 AS value', 123)
+ .then((data) => {
+ console.log('DATA:', data.value)
+ })
+ .catch((error) => {
+ console.log('ERROR:', error)
+ })
+```
## Redis
**Modul**: [redis](https://github.com/mranney/node_redis)
**Installation**
+### Installation
+
```bash
$ npm install redis
```
-**Beispiel**
+### Beispiel
-
-
-var client = require('redis').createClient();
+```js
+const redis = require('redis')
+const client = redis.createClient()
-client.on('error', function (err) {
- console.log('Error ' + err);
-});
+client.on('error', (err) => {
+ console.log(`Error ${err}`)
+})
-client.set('string key', 'string val', redis.print);
-client.hset('hash key', 'hashtest 1', 'some value', redis.print);
-client.hset(['hash key', 'hashtest 2', 'some other value'], redis.print);
+client.set('string key', 'string val', redis.print)
+client.hset('hash key', 'hashtest 1', 'some value', redis.print)
+client.hset(['hash key', 'hashtest 2', 'some other value'], redis.print)
-client.hkeys('hash key', function (err, replies) {
+client.hkeys('hash key', (err, replies) => {
+ console.log(`${replies.length} replies:`)
- console.log(replies.length + ' replies:');
- replies.forEach(function (reply, i) {
- console.log(' ' + i + ': ' + reply);
- });
+ replies.forEach((reply, i) => {
+ console.log(` ${i}: ${reply}`)
+ })
- client.quit();
+ client.quit()
+})
+```
-});
-
-
+## SQL Server
-
+**Module**: [tedious](https://github.com/tediousjs/tedious)
+
+### Installation
+
+```bash
+$ npm install tedious
+```
+
+### Beispiel
+
+```js
+const Connection = require('tedious').Connection
+const Request = require('tedious').Request
+
+const config = {
+ server: 'localhost',
+ authentication: {
+ type: 'default',
+ options: {
+ userName: 'your_username', // update me
+ password: 'your_password' // update me
+ }
+ }
+}
+
+const connection = new Connection(config)
+
+connection.on('connect', (err) => {
+ if (err) {
+ console.log(err)
+ } else {
+ executeStatement()
+ }
+})
+
+function executeStatement () {
+ request = new Request("select 123, 'hello world'", (err, rowCount) => {
+ if (err) {
+ console.log(err)
+ } else {
+ console.log(`${rowCount} rows`)
+ }
+ connection.close()
+ })
+
+ request.on('row', (columns) => {
+ columns.forEach((column) => {
+ if (column.value === null) {
+ console.log('NULL')
+ } else {
+ console.log(column.value)
+ }
+ })
+ })
+
+ connection.execSql(request)
+}
+```
## SQLite
**Modul**: [sqlite3](https://github.com/mapbox/node-sqlite3)
**Installation**
+### Installation
+
```bash
$ npm install sqlite3
```
-**Beispiel**
-
-
-
-var sqlite3 = require('sqlite3').verbose();
-var db = new sqlite3.Database(':memory:');
+### Beispiel
-db.serialize(function() {
+```js
+const sqlite3 = require('sqlite3').verbose()
+const db = new sqlite3.Database(':memory:')
- db.run('CREATE TABLE lorem (info TEXT)');
- var stmt = db.prepare('INSERT INTO lorem VALUES (?)');
+db.serialize(() => {
+ db.run('CREATE TABLE lorem (info TEXT)')
+ const stmt = db.prepare('INSERT INTO lorem VALUES (?)')
- for (var i = 0; i < 10; i++) {
- stmt.run('Ipsum ' + i);
+ for (let i = 0; i < 10; i++) {
+ stmt.run(`Ipsum ${i}`)
}
- stmt.finalize();
+ stmt.finalize()
- db.each('SELECT rowid AS id, info FROM lorem', function(err, row) {
- console.log(row.id + ': ' + row.info);
- });
-});
+ db.each('SELECT rowid AS id, info FROM lorem', (err, row) => {
+ console.log(`${row.id}: ${row.info}`)
+ })
+})
-db.close();
-
-
-
-
+db.close()
+```
## ElasticSearch
**Modul**: [elasticsearch](https://github.com/elastic/elasticsearch-js)
**Installation**
+### Installation
+
```bash
$ npm install elasticsearch
```
-**Beispiel**
+### Beispiel
-
-
-var elasticsearch = require('elasticsearch');
-var client = elasticsearch.Client({
+```js
+const elasticsearch = require('elasticsearch')
+const client = elasticsearch.Client({
host: 'localhost:9200'
-});
+})
client.search({
index: 'books',
@@ -391,10 +497,9 @@ client.search({
}
}
}
-}).then(function(response) {
- var hits = response.hits.hits;
-}, function(error) {
- console.trace(error.message);
-});
-
-
+}).then((response) => {
+ const hits = response.hits.hits
+}, (error) => {
+ console.trace(error.message)
+})
+```
diff --git a/de/guide/debugging.md b/de/guide/debugging.md
old mode 100755
new mode 100644
index ff1879d7ee..49d8f7d47d
--- a/de/guide/debugging.md
+++ b/de/guide/debugging.md
@@ -4,6 +4,7 @@ title: Debugging bei Express
description: Learn how to enable and use debugging logs in Express.js applications by setting the DEBUG environment variable for enhanced troubleshooting.
menu: guide
lang: de
+redirect_from: " "
---
# Debugging bei Express
@@ -17,7 +18,7 @@ $ DEBUG=express:* node index.js
Verwenden Sie unter Windows den entsprechenden Befehl.
```bash
-> set DEBUG=express:* & node index.js
+> $env:DEBUG = "express:*"; node index.js
```
Die Ausführung dieses Befehls für die durch [express generator](/{{ page.lang }}/starter/generator.html) generierte Standardanwendung resultiert in folgender Ausgabe:
@@ -58,11 +59,11 @@ $ DEBUG=express:* node ./bin/www
express:router:layer new / +1ms
express:router use /users router +0ms
express:router:layer new /users +0ms
- express:router use / <anonymous> +0ms
+ express:router use / <anonymous> +0ms
express:router:layer new / +0ms
- express:router use / <anonymous> +0ms
+ express:router use / <anonymous> +0ms
express:router:layer new / +0ms
- express:router use / <anonymous> +0ms
+ express:router use / <anonymous> +0ms
express:router:layer new / +0ms
```
@@ -90,6 +91,8 @@ Wenn Sie nur die Protokolle von der Routerimplementierung sehen wollen, legen Si
## Von `express` generierte Anwendungen
+An application generated by the `express` command uses the `debug` module and its debug namespace is scoped to the name of the application.
+
Beispiel: Wenn Sie die Anwendung mit `$ express sample-app` generiert haben, können Sie die Debuganweisungen mit dem folgenden Befehl aktivieren:
```bash
@@ -101,3 +104,27 @@ Sie können mehrere Debug-Namespaces in einer durch Kommas getrennten Namenslist
```bash
$ DEBUG=http,mail,express:* node index.js
```
+
+## Advanced options
+
+When running through Node.js, you can set a few environment variables that will change the behavior of the debug logging:
+
+| Name | Purpose |
+| ------------------- | ----------------------------------------------------------------- |
+| `DEBUG` | Enables/disables specific debugging namespaces. |
+| `DEBUG_COLORS` | Whether or not to use colors in the debug output. |
+| `DEBUG_DEPTH` | Object inspection depth. |
+| `DEBUG_FD` | File descriptor to write debug output to. |
+| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
+
+{% capture debug-text %}
+
+The environment variables beginning with `DEBUG_` end up being
+converted into an Options object that gets used with `%o`/`%O` formatters.
+See the Node.js documentation for
+[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
+for the complete list.
+
+{% endcapture %}
+
+{% include admonitions/note.html content=debug-text %}
diff --git a/de/guide/error-handling.md b/de/guide/error-handling.md
old mode 100755
new mode 100644
index 5e01345df9..dc3fde4319
--- a/de/guide/error-handling.md
+++ b/de/guide/error-handling.md
@@ -4,11 +4,185 @@ title: Fehlerbehandlung in Express
description: Understand how Express.js handles errors in synchronous and asynchronous code, and learn to implement custom error handling middleware for your applications.
menu: guide
lang: de
+redirect_from: " "
---
# Fehlerbehandlung
+_Error Handling_ refers to how Express catches and processes errors that
+occur both synchronously and asynchronously. Express comes with a default error
+handler so you don't need to write your own to get started.
+
+## Catching Errors
+
+It's important to ensure that Express catches all errors that occur while
+running route handlers and middleware.
+
+Errors that occur in synchronous code inside route handlers and middleware
+require no extra work. If synchronous code throws an error, then Express will
+catch and process it. Beispiel:
+
+```js
+app.get('/', (req, res) => {
+ throw new Error('BROKEN') // Express will catch this on its own.
+})
+```
+
Middlewarefunktionen für die Fehlerbehandlung werden in derselben Weise definiert wie andere Middlewarefunktionen, nur, dass Fehlerbehandlungsfunktionen vier anstatt drei Argumente aufweisen:
+`(err, req, res, next)`. Beispiel:
+
+```js
+app.get('/', (req, res, next) => {
+ fs.readFile('/file-does-not-exist', (err, data) => {
+ if (err) {
+ next(err) // Pass errors to Express.
+ } else {
+ res.send(data)
+ }
+ })
+})
+```
+
+Middleware für die Fehlerbehandlung wird ganz zuletzt nach allen anderen `app.use()`- und Weiterleitungsaufrufen definiert.
+Beispiel:
+
+```js
+app.get('/user/:id', async (req, res, next) => {
+ const user = await getUserById(req.params.id)
+ res.send(user)
+})
+```
+
+If `getUserById` throws an error or rejects, `next` will be called with either
+the thrown error or the rejected value. If no rejected value is provided, `next`
+will be called with a default Error object provided by the Express router.
+
+Wenn Sie Übergaben an die Funktion `next()` vornehmen (außer die Zeichenfolge `'route'`), sieht Express die aktuelle Anforderung als Fehler an und überspringt alle verbleibenden fehlerfreien Behandlungsroutinen und Middlewarefunktionen.
+
+If the callback in a sequence provides no data, only errors, you can simplify
+this code as follows:
+
+```js
+app.get('/', [
+ function (req, res, next) {
+ fs.writeFile('/inaccessible-path', 'data', next)
+ },
+ function (req, res) {
+ res.send('OK')
+ }
+])
+```
+
+In the above example, `next` is provided as the callback for `fs.writeFile`,
+which is called with or without errors. If there is no error, the second
+handler is executed, otherwise Express catches and processes the error.
+
+Bei einem Routenhandler mit mehreren Callback-Funktionen können Sie den Parameter `route` verwenden, um den nächsten Routenhandler zu überspringen. Beispiel:
+
+```js
+app.get('/', (req, res, next) => {
+ setTimeout(() => {
+ try {
+ throw new Error('BROKEN')
+ } catch (err) {
+ next(err)
+ }
+ }, 100)
+})
+```
+
+The above example uses a `try...catch` block to catch errors in the
+asynchronous code and pass them to Express. If the `try...catch`
+block were omitted, Express would not catch the error since it is not part of the synchronous
+handler code.
+
+Use promises to avoid the overhead of the `try...catch` block or when using functions
+that return promises. Beispiel:
+
+```js
+app.get('/', (req, res, next) => {
+ Promise.resolve().then(() => {
+ throw new Error('BROKEN')
+ }).catch(next) // Errors will be passed to Express.
+})
+```
+
+Since promises automatically catch both synchronous errors and rejected promises,
+you can simply provide `next` as the final catch handler and Express will catch errors,
+because the catch handler is given the error as the first argument.
+
+You could also use a chain of handlers to rely on synchronous error
+catching, by reducing the asynchronous code to something trivial. Beispiel:
+
+```js
+app.get('/', [
+ function (req, res, next) {
+ fs.readFile('/maybe-valid-file', 'utf-8', (err, data) => {
+ res.locals.data = data
+ next(err)
+ })
+ },
+ function (req, res) {
+ res.locals.data = res.locals.data.split(',')[1]
+ res.send(res.locals.data)
+ }
+])
+```
+
+The above example has a couple of trivial statements from the `readFile`
+call. If `readFile` causes an error, then it passes the error to Express, otherwise you
+quickly return to the world of synchronous error handling in the next handler
+in the chain. Then, the example above tries to process the data. If this fails, then the
+synchronous error handler will catch it. If you had done this processing inside
+the `readFile` callback, then the application might exit and the Express error
+handlers would not run.
+
+Whichever method you use, if you want Express error handlers to be called in and the
+application to survive, you must ensure that Express receives the error.
+
+## Die Standardfehlerbehandlungsroutine (Default Error Handler)
+
+Express ist bereits mit einer integrierten Fehlerbehandlungsroutine ausgestattet, mit der alle in der Anwendung festgestellten Fehler gehandhabt werden können. Diese Middleware für die Fehlerbehandlung wird am Ende des Middleware-Funktionsstack hinzugefügt.
+
+Wenn Sie einen Fehler an `next()` übergeben und diesen nicht mit einem Error-Handler bearbeiten, wird dieser über den integrierten Error-Handler bearbeitet. Der Fehler wird mit dem Stack-Trace zum Client geschrieben. Der Stack-Trace ist in der Produktionsumgebung nicht verfügbar.
+
+Express 3 | Express 4 |
---|---|
Express 3 | Express 4 |
express.bodyParser |
body-parser + multer | serve-index |
express.static |
serve-static |
app.use
akzeptiert Parameter. app.route()
Objekt | Beschreibung | -Die Funktion `app.configure()` wurde entfernt. Verwenden Sie die Funktion `process.env.NODE_ENV` oder `app.get('env')`, um die Umgebung zu erkennen und die Anwendung entsprechend zu konfigurieren. +Die Funktion `app.configure()` wurde entfernt. Verwenden Sie die Funktion `process.env.NODE_ENV` oder `app.get('env')`, um die Umgebung zu erkennen und die Anwendung entsprechend zu konfigurieren. |
---|---|
res.send(status)
, nicht mehr, wobei *`status`* für eine Zahl steht. Verwenden Sie stattdessen die Funktion `res.sendStatus(statusCode)`, mit der der Statuscode für den HTTP-Antwort-Header festgelegt und die Textversion des Codes gesendet wird: "Not Found" (Nicht gefunden), "Internal Server Error" (Interner Serverfehler) usw. Wenn Sie eine Zahl senden und hierfür die Funktion `res.send()` verwenden müssen, müssen Sie die Zahl in Anführungszeichen setzen, um diese in eine Zeichenfolge zu konvertieren. Dadurch interpretiert Express diese Zahl nicht als Versuch, die nicht mehr unterstützte alte Signatur zu verwenden.
+Express 5 unterstützt die Signatur res.send(status)
, nicht mehr, wobei _`status`_ für eine Zahl steht. Verwenden Sie stattdessen die Funktion `res.sendStatus(statusCode)`, mit der der Statuscode für den HTTP-Antwort-Header festgelegt und die Textversion des Codes gesendet wird: "Not Found" (Nicht gefunden), "Internal Server Error" (Interner Serverfehler) usw.
+Wenn Sie eine Zahl senden und hierfür die Funktion `res.send()` verwenden müssen, müssen Sie die Zahl in Anführungszeichen setzen, um diese in eine Zeichenfolge zu konvertieren. Dadurch interpretiert Express diese Zahl nicht als Versuch, die nicht mehr unterstützte alte Signatur zu verwenden.
+
+{% include admonitions/note.html content=codemod-deprecated-signatures %}
+
+```js
+// v4
+app.get('/user', (req, res) => {
+ res.send(200)
+})
+
+// v5
+app.get('/user', (req, res) => {
+ res.sendStatus(200)
+})
+```
-![]()
Beispiel+ +Here is an example of a simple "Hello World" Express application. +The remainder of this article will define and add three middleware functions to the application: +one called `myLogger` that prints a simple log message, one called `requestTime` that +displays the timestamp of the HTTP request, and one called `validateCookies` that validates incoming cookies. ```js const express = require('express') @@ -55,8 +63,7 @@ app.get('/', (req, res) => { app.listen(3000) ``` -Entwicklung- +Dies ist ein Beispiel einer einfachen Express-Anwendung namens "Hello World", für die Sie zwei Middlewarefunktionen definieren:Dies ist ein einfaches Beispiel einer Middlewarefunktion namens "myLogger". Diese Funktion gibt lediglich "LOGGED" aus, wenn eine Anforderung zur Anwendung über diese Funktion läuft. Die Middlewarefunktion ist der Variablen `myLogger` zugeordnet. ```js @@ -67,11 +74,13 @@ const myLogger = function (req, res, next) { ```
-Beachten Sie den Aufruf oben zu `next()`. Durch den Aufruf dieser Funktion wird die nächste Middlewarefunktion in der Anwendung aufgerufen. Die Funktion `next()` ist nicht Teil der Node.js- oder Express-API, sondern das dritte Argument, das an die Middlewarefunktion übergeben wird. Die Funktion `next()` kann jeden beliebigen Namen haben, per Konvention erhält sie jedoch immer den Namen "next". Um Unklarheiten zu vermeiden, sollten Sie immer diese Konvention verwenden.
+Beachten Sie den Aufruf oben zu `next()`. Durch den Aufruf dieser Funktion wird die nächste Middlewarefunktion in der Anwendung aufgerufen.
+Die Funktion `next()` ist nicht Teil der Node.js- oder Express-API, sondern das dritte Argument, das an die Middlewarefunktion übergeben wird. Die Funktion `next()` kann jeden beliebigen Namen haben, per Konvention erhält sie jedoch immer den Namen "next".
+Um Unklarheiten zu vermeiden, sollten Sie immer diese Konvention verwenden.
-
-Zum Laden der Middlewarefunktion rufen Sie `app.use()` auf und geben die Middlewarefunktion an. Beispiel: Durch den folgenden Code wird die Middlewarefunktion `myLogger` vor der Weiterleitung zum Stammverzeichnispfad (/) geladen.
+Zum Laden der Middlewarefunktion rufen Sie `app.use()` auf und geben die Middlewarefunktion an.
+Beispiel: Durch den folgenden Code wird die Middlewarefunktion `myLogger` vor der Weiterleitung zum Stammverzeichnispfad (/) geladen.
```js
const express = require('express')
@@ -99,6 +108,8 @@ Wenn `myLogger` nach der Weiterleitung zum Stammverzeichnispfad geladen wird, er
Die Middlewarefunktion `myLogger` gibt einfach eine Nachricht aus und übergibt dann die Anforderung zur nächsten Middlewarefunktion im Stack durch Aufruf der Funktion `next()`.
+Middleware function requestTime+ Im nächsten Beispiel wird die Eigenschaft `requestTime` zum Anforderungsobjekt hinzugefügt. Diese Middlewarefunktion erhält den Namen "requestTime". ```js @@ -129,8 +140,80 @@ app.get('/', (req, res) => { app.listen(3000) ``` + Wenn Sie eine Anforderung zum Stammverzeichnis der Anwendung einleiten, zeigt die Anwendung nun die Zeitmarke Ihrer Anforderung im Browser an. +Middleware function validateCookies+ +Finally, we'll create a middleware function that validates incoming cookies and sends a 400 response if cookies are invalid. + +Here's an example function that validates cookies with an external async service. + +```js +async function cookieValidator (cookies) { + try { + await externallyValidateCookie(cookies.testCookie) + } catch { + throw new Error('Invalid cookies') + } +} +``` + +Here, we use the [`cookie-parser`](/resources/middleware/cookie-parser.html) middleware to parse incoming cookies off the `req` object and pass them to our `cookieValidator` function. The `validateCookies` middleware returns a Promise that upon rejection will automatically trigger our error handler. + +```js +const express = require('express') +const cookieParser = require('cookie-parser') +const cookieValidator = require('./cookieValidator') + +const app = express() + +async function validateCookies (req, res, next) { + await cookieValidator(req.cookies) + next() +} + +app.use(cookieParser()) + +app.use(validateCookies) + +// error handler +app.use((err, req, res, next) => { + res.status(400).send(err.message) +}) + +app.listen(3000) +``` + +
+Note how `next()` is called after `await cookieValidator(req.cookies)`. This ensures that if `cookieValidator` resolves, the next middleware in the stack will get called. If you pass anything to the `next()` function (except the string `'route'` or `'router'`), Express regards the current request as being an error and will skip any remaining non-error handling routing and middleware functions.
+
+
Da Sie Zugriff auf das Anforderungsobjekt, das Antwortobjekt, die nächste Middlewarefunktion im Stack und die gesamte Node.js-API haben, sind die Möglichkeiten, die Sie mit Middlewarefunktionen haben, nahezu unendlich.
Weitere Informationen zur Verwendung von Middleware in Express siehe [ Express-Middleware verwenden](/{{ page.lang }}/guide/using-middleware.html).
+
+Configurable middleware+ +If you need your middleware to be configurable, export a function which accepts an options object or other parameters, which, then returns the middleware implementation based on the input parameters. + +File: `my-middleware.js` + +```js +module.exports = function (options) { + return function (req, res, next) { + // Implement the middleware function based on the options object + next() + } +} +``` + +The middleware can now be used as shown below. + +```js +const mw = require('./my-middleware.js') + +app.use(mw({ option1: '1', option2: '2' })) +``` + +Refer to [cookie-session](https://github.com/expressjs/cookie-session) and [compression](https://github.com/expressjs/compression) for examples of configurable middleware. diff --git a/de/index.md b/de/index.md index 6f02e6b770..853732a008 100644 --- a/de/index.md +++ b/de/index.md @@ -1,43 +1,64 @@ --- layout: home -title: Express - Node.js-Framework von Webanwendungen -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 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. menu: home lang: de +redirect_from: " " --- +
+ Schnelles, offenes, unkompliziertes Web-Framework für Node.js+ +Fast, unopinionated, minimalist web framework for Node.js$ npm install express --save
+
-
+
+
diff --git a/es/4x/api.md b/es/4x/api.md
old mode 100755
new mode 100644
index bc90b2e805..a8662e41be
--- a/es/4x/api.md
+++ b/es/4x/api.md
@@ -2,27 +2,26 @@
layout: api
version: 4x
title: Express 4.x - Referencia de API
-lang: es
-description: Access the API reference for Express.js 4.x, detailing all modules, methods,
- and properties for building web applications with this version.
+description: Access the API reference for Express.js 4.x, detailing all modules, methods, and properties for building web applications with this version.
+lang: en
+redirect_from: " "
---
+
+
+```javascript
+const express = require('express')
+const app = express()
+const port = 3000
+
+app.get('/', (req, res) => {
+ res.send('Hello World!')
+})
+
+app.listen(port, () => {
+ console.log(`Example app listening on port ${port}`)
+})
+```
+
-
+{% if site.announcement %}
+
+
-
-
-
- WebanwendungenExpress ist ein einfaches und flexibles Node.js-Framework von Webanwendungen, das zahlreiche leistungsfähige Features und Funktionen für Webanwendungen und mobile Anwendungen bereitstellt. -
-
-
- APIsMithilfe unzähliger HTTP-Dienstprogrammmethoden und Middlewarefunktionen gestaltet sich das Erstellen einer leistungsfähigen API schnell und einfach.
-
-
- LeistungExpress bietet eine Thin-Layer-Ebene mit grundlegenden Webanwendungsfunktionen, ohne die bekannten Node.js-Features zu überlagern.
-
+ LoopBackEntwickeln Sie modellorientierte Anwendungen mit einem Express-basierten Framework.Weitere Informationen finden Sie unter loopback.io. -
+
+ Web ApplicationsExpress is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. +
+
+ APIsWith a myriad of HTTP utility methods and middleware at your disposal, creating a robust API is quick and easy. +
+
+ PerformanceExpress provides a thin layer of fundamental web application features, without obscuring Node.js features that you know and love. +
+
Middleware+ Express is a lightweight and flexible routing framework with minimal core features + meant to be augmented through the use of Express middleware modules. +
+
+
+
-Erstellen Sie zunächst ein Verzeichnis namens `myapp`, wechseln Sie in das Verzeichnis und führen Sie `npm init` aus. Installieren Sie dann `express` als Abhängigkeit, wie im [Installationshandbuch](/{{ page.lang }}/starter/installing.html) beschrieben.
-
-Erstellen Sie im Verzeichnis `myapp` eine Datei namens `app.js` und fügen Sie den folgenden Code hinzu:
-
```js
const express = require('express')
const app = express()
@@ -30,11 +27,15 @@ app.listen(port, () => {
})
```
-Die Anwendung startet einen Server und ist an Port 3000 empfangsbereit für Verbindungen. Die Anwendung antwortet mit "Hello World!" auf Anforderungen zur Stamm-URL (`/`) oder zu *route*. Bei jedem anderen Pfad lautet die Antwort **404 Not Found**.
+Die Anwendung startet einen Server und ist an Port 3000 empfangsbereit für Verbindungen. Die Anwendung antwortet mit "Hello World!" auf Anforderungen zur Stamm-URL (`/`) oder zu _route_. Bei jedem anderen Pfad lautet die Antwort **404 Not Found**.
-
+
\ No newline at end of file
diff --git a/de/resources/contributing.md b/de/resources/contributing.md
new file mode 100644
index 0000000000..4f6e759006
--- /dev/null
+++ b/de/resources/contributing.md
@@ -0,0 +1,551 @@
+---
+layout: page
+title: Contributing to Express
+description: Find out how to contribute to Express.js, including guidelines for reporting issues, submitting pull requests, becoming a collaborator, and understanding security policies.
+menu: resources
+lang: de
+redirect_from: " "
+---
+
+# Contributing to Express
+
+### Looking to contribute to Expressjs.com? Click [here](#expressjs-website-contributing).
+
+Express and the other projects in the [expressjs organization on GitHub](https://github.com/expressjs) are projects of the [OpenJs Foundation](https://openjsf.org/).
+These projects are governed under the general policies and guidelines of the Node.js Foundation along with the additional guidelines below.
+
+- [Technical committee](#technical-committee)
+- [Community contributing guide](#community-contributing-guide)
+- [Collaborator's guide](#collaborators-guide)
+- [Security policies and procedures](#security-policies-and-procedures)
+
+## Technical committee
+
+The Express technical committee consists of active project members, and guides development and maintenance of the Express project. For more information, see [Express Community - Technical committee](community.html#technical-committee).
+
+## Community contributing guide
+
+
+
+The goal of this document is to create a contribution process that:
+
+- Encourages new contributions.
+- Encourages contributors to remain involved.
+- Avoids unnecessary processes and bureaucracy whenever possible.
+- Creates a transparent decision making process that makes it clear how
+ contributors can be involved in decision making.
+
+### Vocabulary
+
+- A **Contributor** is any individual creating or commenting on an issue or pull request.
+- A **Committer** is a subset of contributors who have been given write access to the repository.
+- A **Project Captain** is the lead maintainer of a repository.
+- A **TC (Technical Committee)** is a group of committers representing the required technical
+ expertise to resolve rare disputes.
+- A **Triager** is a subset of contributors who have been given triage access to the repository.
+
+### Logging Issues
+
+Log an issue for any question or problem you might have. When in doubt, log an issue, and
+any additional policies about what to include will be provided in the responses. The only
+exception is security disclosures which should be sent privately.
+
+Committers may direct you to another repository, ask for additional clarifications, and
+add appropriate metadata before the issue is addressed.
+
+Please be courteous and respectful. Every participant is expected to follow the
+project's Code of Conduct.
+
+### Contributions
+
+Any change to resources in this repository must be through pull requests. This applies to all changes
+to documentation, code, binary files, etc. Even long term committers and TC members must use
+pull requests.
+
+No pull request can be merged without being reviewed.
+
+For non-trivial contributions, pull requests should sit for at least 36 hours to ensure that
+contributors in other timezones have time to review. Consideration should also be given to
+weekends and other holiday periods to ensure active committers all have reasonable time to
+become involved in the discussion and review process if they wish.
+
+The default for each contribution is that it is accepted once no committer has an objection.
+During a review, committers may also request that a specific contributor who is most versed in a
+particular area gives a "LGTM" before the PR can be merged. There is no additional "sign off"
+process for contributions to land. Once all issues brought by committers are addressed it can
+be landed by any committer.
+
+In the case of an objection being raised in a pull request by another committer, all involved
+committers should seek to arrive at a consensus by way of addressing concerns being expressed
+by discussion, compromise on the proposed change, or withdrawal of the proposed change.
+
+If a contribution is controversial and committers cannot agree about how to get it to land
+or if it should land then it should be escalated to the TC. TC members should regularly
+discuss pending contributions in order to find a resolution. It is expected that only a
+small minority of issues be brought to the TC for resolution and that discussion and
+compromise among committers be the default resolution mechanism.
+
+### Becoming a Triager
+
+Anyone can become a triager! Read more about the process of being a triager in
+[the triage process document](https://github.com/expressjs/express/blob/master/Triager-Guide.md).
+
+Currently, any existing [organization member](https://github.com/orgs/expressjs/people) can nominate
+a new triager. If you are interested in becoming a triager, our best advice is to actively participate
+in the community by helping triaging issues and pull requests. As well we recommend
+to engage in other community activities like attending the TC meetings, and participating in the Slack
+discussions. If you feel ready and have been helping triage some issues, reach out to an active member of the organization to ask if they'd
+be willing to support you. If they agree, they can create a pull request to formalize your nomination. In the case of an objection to the nomination, the triage team is responsible for working with the individuals involved and finding a resolution.
+
+You can also reach out to any of the [organization members](https://github.com/orgs/expressjs/people)
+if you have questions or need guidance.
+
+### Becoming a Committer
+
+All contributors who have landed significant and valuable contributions should be onboarded in a timely manner,
+and added as a committer, and be given write access to the repository.
+
+Committers are expected to follow this policy and continue to send pull requests, go through
+proper review, and have other committers merge their pull requests.
+
+### TC Process
+
+The TC uses a "consensus seeking" process for issues that are escalated to the TC.
+The group tries to find a resolution that has no open objections among TC members.
+If a consensus cannot be reached that has no objections then a majority wins vote
+is called. It is also expected that the majority of decisions made by the TC are via
+a consensus seeking process and that voting is only used as a last-resort.
+
+Resolution may involve returning the issue to project captains with suggestions on
+how to move forward towards a consensus. It is not expected that a meeting of the TC
+will resolve all issues on its agenda during that meeting and may prefer to continue
+the discussion happening among the project captains.
+
+Members can be added to the TC at any time. Any TC member can nominate another committer
+to the TC and the TC uses its standard consensus seeking process to evaluate whether or
+not to add this new member. The TC will consist of a minimum of 3 active members and a
+maximum of 10. If the TC should drop below 5 members the active TC members should nominate
+someone new. If a TC member is stepping down, they are encouraged (but not required) to
+nominate someone to take their place.
+
+TC members will be added as admin's on the Github orgs, npm orgs, and other resources as
+necessary to be effective in the role.
+
+To remain "active" a TC member should have participation within the last 12 months and miss
+no more than six consecutive TC meetings. Our goal is to increase participation, not punish
+people for any lack of participation, this guideline should be only be used as such
+(replace an inactive member with a new active one, for example). Members who do not meet this
+are expected to step down. If A TC member does not step down, an issue can be opened in the
+discussions repo to move them to inactive status. TC members who step down or are removed due
+to inactivity will be moved into inactive status.
+
+Inactive status members can become active members by self nomination if the TC is not already
+larger than the maximum of 10. They will also be given preference if, while at max size, an
+active member steps down.
+
+### Project Captains
+
+The Express TC can designate captains for individual projects/repos in the
+organizations. These captains are responsible for being the primary
+day-to-day maintainers of the repo on a technical and community front.
+Repo captains are empowered with repo ownership and package publication rights.
+When there are conflicts, especially on topics that effect the Express project
+at large, captains are responsible to raise it up to the TC and drive
+those conflicts to resolution. Captains are also responsible for making sure
+community members follow the community guidelines, maintaining the repo
+and the published package, as well as in providing user support.
+
+Like TC members, Repo captains are a subset of committers.
+
+To become a captain for a project the candidate is expected to participate in that
+project for at least 6 months as a committer prior to the request. They should have
+helped with code contributions as well as triaging issues. They are also required to
+have 2FA enabled on both their GitHub and npm accounts.
+
+Any TC member or an existing captain on the **same** repo can nominate another committer
+to the captain role. To do so, they should submit a PR to this document, updating the
+**Active Project Captains** section (while maintaining the sort order) with the project
+name, the nominee's GitHub handle, and their npm username (if different).
+
+- Repos can have as many captains as make sense for the scope of work.
+- A TC member or an existing repo captain **on the same project** can nominate a new captain.
+ Repo captains from other projects should not nominate captains for a different project.
+
+The PR will require at least 2 approvals from TC members and 2 weeks hold time to allow
+for comment and/or dissent. When the PR is merged, a TC member will add them to the
+proper GitHub/npm groups.
+
+#### Active Projects and Captains
+
+- [`expressjs/badgeboard`](https://github.com/expressjs/badgeboard): @wesleytodd
+- [`expressjs/basic-auth-connect`](https://github.com/expressjs/basic-auth-connect): @ulisesGascon
+- [`expressjs/body-parser`](https://github.com/expressjs/body-parser): @wesleytodd, @jonchurch, @ulisesGascon
+- [`expressjs/compression`](https://github.com/expressjs/compression): @ulisesGascon
+- [`expressjs/connect-multiparty`](https://github.com/expressjs/connect-multiparty): @ulisesGascon
+- [`expressjs/cookie-parser`](https://github.com/expressjs/cookie-parser): @wesleytodd, @UlisesGascon
+- [`expressjs/cookie-session`](https://github.com/expressjs/cookie-session): @ulisesGascon
+- [`expressjs/cors`](https://github.com/expressjs/cors): @jonchurch, @ulisesGascon
+- [`expressjs/discussions`](https://github.com/expressjs/discussions): @wesleytodd
+- [`expressjs/errorhandler`](https://github.com/expressjs/errorhandler): @ulisesGascon
+- [`expressjs/express-paginate`](https://github.com/expressjs/express-paginate): @ulisesGascon
+- [`expressjs/express`](https://github.com/expressjs/express): @wesleytodd, @ulisesGascon
+- [`expressjs/expressjs.com`](https://github.com/expressjs/expressjs.com): @crandmck, @jonchurch, @bjohansebas
+- [`expressjs/flash`](https://github.com/expressjs/flash): @ulisesGascon
+- [`expressjs/generator`](https://github.com/expressjs/generator): @wesleytodd
+- [`expressjs/method-override`](https://github.com/expressjs/method-override): @ulisesGascon
+- [`expressjs/morgan`](https://github.com/expressjs/morgan): @jonchurch, @ulisesGascon
+- [`expressjs/multer`](https://github.com/expressjs/multer): @LinusU, @ulisesGascon
+- [`expressjs/response-time`](https://github.com/expressjs/response-time): @UlisesGascon
+- [`expressjs/serve-favicon`](https://github.com/expressjs/serve-favicon): @ulisesGascon
+- [`expressjs/serve-index`](https://github.com/expressjs/serve-index): @ulisesGascon
+- [`expressjs/serve-static`](https://github.com/expressjs/serve-static): @ulisesGascon
+- [`expressjs/session`](https://github.com/expressjs/session): @ulisesGascon
+- [`expressjs/statusboard`](https://github.com/expressjs/statusboard): @wesleytodd
+- [`expressjs/timeout`](https://github.com/expressjs/timeout): @ulisesGascon
+- [`expressjs/vhost`](https://github.com/expressjs/vhost): @ulisesGascon
+- [`jshttp/accepts`](https://github.com/jshttp/accepts): @blakeembrey
+- [`jshttp/basic-auth`](https://github.com/jshttp/basic-auth): @blakeembrey
+- [`jshttp/compressible`](https://github.com/jshttp/compressible): @blakeembrey
+- [`jshttp/content-disposition`](https://github.com/jshttp/content-disposition): @blakeembrey
+- [`jshttp/content-type`](https://github.com/jshttp/content-type): @blakeembrey
+- [`jshttp/cookie`](https://github.com/jshttp/cookie): @blakeembrey
+- [`jshttp/etag`](https://github.com/jshttp/etag): @blakeembrey
+- [`jshttp/forwarded`](https://github.com/jshttp/forwarded): @blakeembrey
+- [`jshttp/fresh`](https://github.com/jshttp/fresh): @blakeembrey
+- [`jshttp/http-assert`](https://github.com/jshttp/http-assert): @wesleytodd, @jonchurch, @ulisesGascon
+- [`jshttp/http-errors`](https://github.com/jshttp/http-errors): @wesleytodd, @jonchurch, @ulisesGascon
+- [`jshttp/media-typer`](https://github.com/jshttp/media-typer): @blakeembrey
+- [`jshttp/methods`](https://github.com/jshttp/methods): @blakeembrey
+- [`jshttp/mime-db`](https://github.com/jshttp/mime-db): @blakeembrey, @UlisesGascon
+- [`jshttp/mime-types`](https://github.com/jshttp/mime-types): @blakeembrey, @UlisesGascon
+- [`jshttp/negotiator`](https://github.com/jshttp/negotiator): @blakeembrey
+- [`jshttp/on-finished`](https://github.com/jshttp/on-finished): @wesleytodd, @ulisesGascon
+- [`jshttp/on-headers`](https://github.com/jshttp/on-headers): @blakeembrey
+- [`jshttp/proxy-addr`](https://github.com/jshttp/proxy-addr): @wesleytodd, @ulisesGascon
+- [`jshttp/range-parser`](https://github.com/jshttp/range-parser): @blakeembrey
+- [`jshttp/statuses`](https://github.com/jshttp/statuses): @blakeembrey
+- [`jshttp/type-is`](https://github.com/jshttp/type-is): @blakeembrey
+- [`jshttp/vary`](https://github.com/jshttp/vary): @blakeembrey
+- [`pillarjs/cookies`](https://github.com/pillarjs/cookies): @blakeembrey
+- [`pillarjs/csrf`](https://github.com/pillarjs/csrf): @ulisesGascon
+- [`pillarjs/encodeurl`](https://github.com/pillarjs/encodeurl): @blakeembrey
+- [`pillarjs/finalhandler`](https://github.com/pillarjs/finalhandler): @wesleytodd, @ulisesGascon
+- [`pillarjs/hbs`](https://github.com/pillarjs/hbs): @ulisesGascon
+- [`pillarjs/multiparty`](https://github.com/pillarjs/multiparty): @blakeembrey
+- [`pillarjs/parseurl`](https://github.com/pillarjs/parseurl): @blakeembrey
+- [`pillarjs/path-to-regexp`](https://github.com/pillarjs/path-to-regexp): @blakeembrey
+- [`pillarjs/request`](https://github.com/pillarjs/request): @wesleytodd
+- [`pillarjs/resolve-path`](https://github.com/pillarjs/resolve-path): @blakeembrey
+- [`pillarjs/router`](https://github.com/pillarjs/router): @wesleytodd, @ulisesGascon
+- [`pillarjs/send`](https://github.com/pillarjs/send): @blakeembrey
+- [`pillarjs/understanding-csrf`](https://github.com/pillarjs/understanding-csrf): @ulisesGascon
+
+#### Current Initiative Captains
+
+- Triage team [ref](https://github.com/expressjs/discussions/issues/227): @UlisesGascon
+
+### Developer's Certificate of Origin 1.1
+
+```text
+By making a contribution to this project, I certify that:
+
+ (a) The contribution was created in whole or in part by me and I
+ have the right to submit it under the open source license
+ indicated in the file; or
+
+ (b) The contribution is based upon previous work that, to the best
+ of my knowledge, is covered under an appropriate open source
+ license and I have the right under that license to submit that
+ work with modifications, whether created in whole or in part
+ by me, under the same open source license (unless I am
+ permitted to submit under a different license), as indicated
+ in the file; or
+
+ (c) The contribution was provided directly to me by some other
+ person who certified (a), (b) or (c) and I have not modified
+ it.
+
+ (d) I understand and agree that this project and the contribution
+ are public and that a record of the contribution (including all
+ personal information I submit with it, including my sign-off) is
+ maintained indefinitely and may be redistributed consistent with
+ this project or the open source license(s) involved.
+```
+
+## Collaborator's guide
+
+
+
+### Website Issues
+
+Open issues for the expressjs.com website in https://github.com/expressjs/expressjs.com.
+
+### PRs and Code contributions
+
+- Tests must pass.
+- Follow the [JavaScript Standard Style](https://standardjs.com/) and `npm run lint`.
+- If you fix a bug, add a test.
+
+### Branches
+
+Use the `master` branch for bug fixes or minor work that is intended for the
+current release stream.
+
+Use the correspondingly named branch, e.g. `5.0`, for anything intended for
+a future release of Express.
+
+### Steps for contributing
+
+1. [Create an issue](https://github.com/expressjs/express/issues/new) for the
+ bug you want to fix or the feature that you want to add.
+2. Create your own [fork](https://github.com/expressjs/express) on GitHub, then
+ checkout your fork.
+3. Write your code in your local copy. It's good practice to create a branch for
+ each new issue you work on, although not compulsory.
+4. To run the test suite, first install the dependencies by running `npm install`,
+ then run `npm test`.
+5. Ensure your code is linted by running `npm run lint` -- fix any issue you
+ see listed.
+6. If the tests pass, you can commit your changes to your fork and then create
+ a pull request from there. Make sure to reference your issue from the pull
+ request comments by including the issue number e.g. `#123`.
+
+### Issues which are questions
+
+We will typically close any vague issues or questions that are specific to some
+app you are writing. Please double check the docs and other references before
+being trigger happy with posting a question issue.
+
+Things that will help get your question issue looked at:
+
+- Full and runnable JS code.
+- Clear description of the problem or unexpected behavior.
+- Clear description of the expected result.
+- Steps you have taken to debug it yourself.
+
+If you post a question and do not outline the above items or make it easy for
+us to understand and reproduce your issue, it will be closed.
+
+## Security Policies and Procedures
+
+
+
+This document outlines security procedures and general policies for the Express
+project.
+
+- [Reporting a Bug](#reporting-a-bug)
+- [Disclosure Policy](#disclosure-policy)
+- [Comments on this Policy](#comments-on-this-policy)
+
+### Reporting a Bug
+
+The Express team and community take all security bugs in Express seriously.
+Thank you for improving the security of Express. We appreciate your efforts and
+responsible disclosure and will make every effort to acknowledge your
+contributions.
+
+Report security bugs by emailing `express-security@lists.openjsf.org`.
+
+To ensure the timely response to your report, please ensure that the entirety
+of the report is contained within the email body and not solely behind a web
+link or an attachment.
+
+The lead maintainer will acknowledge your email within 48 hours, and will send a
+more detailed response within 48 hours indicating the next steps in handling
+your report. After the initial reply to your report, the security team will
+endeavor to keep you informed of the progress towards a fix and full
+announcement, and may ask for additional information or guidance.
+
+Report security bugs in third-party modules to the person or team maintaining
+the module.
+
+### Pre-release Versions
+
+Alpha and Beta releases are unstable and **not suitable for production use**.
+Vulnerabilities found in pre-releases should be reported according to the [Reporting a Bug](#reporting-a-bug) section.
+Due to the unstable nature of the branch it is not guaranteed that any fixes will be released in the next pre-release.
+
+### Disclosure Policy
+
+When the security team receives a security bug report, they will assign it to a
+primary handler. This person will coordinate the fix and release process,
+involving the following steps:
+
+- Confirm the problem and determine the affected versions.
+- Audit code to find any potential similar problems.
+- Prepare fixes for all releases still under maintenance. These fixes will be
+ released as fast as possible to npm.
+
+### The Express Threat Model
+
+We are currently working on a new version of the security model, the most updated version can be found [here](https://github.com/expressjs/security-wg/blob/main/docs/ThreatModel.md)
+
+### Comments on this Policy
+
+If you have suggestions on how this process could be improved please submit a
+pull request.
+
+----
+
+# Contributing to Expressjs.com {#expressjs-website-contributing}
+
+
+
+### The Official Documentation of the Express JS Framework
+
+This is the contribution documentation for the [Expressjs.com](https://github.com/expressjs/expressjs.com) website.
+
+#### Need some ideas? These are some typical issues.
+
+1. **Website issues**:
+ If you see anything on the site that could use a tune-up, think about how to fix it.
+
+ - Display or screen sizing problems
+ - Mobile responsiveness issues
+ - Missing or broken accessibility features
+ - Website outages
+ - Broken links
+ - Page structure or user interface enhancements
+
+2. **Content Issues**:
+ Fix anything related to site content or typos.
+ - Spelling errors
+ - Incorrect/outdated Express JS documentation
+ - Missing content
+
+3. **Translation Issues**: Fix any translation errors or contribute new content.
+ - Fix spelling errors
+ - Fix incorrect/poorly translated words
+ - Translate new content
+
+> **IMPORTANT:**
+> All translation submissions are currently paused. See this [notice](#notice-we-have-paused-all-translation-contributions) for more information.
+
+- Check out the [Contributing translations](#contributing-translations) section below for a contributing guide.
+
+#### Want to work on a backlog issue?
+
+We often have bugs or enhancements that need work. You can find these under our repo's [Issues tab](https://github.com/expressjs/expressjs.com/issues). Check out the tags to find something that's a good match for you.
+
+#### Have an idea? Found a bug?
+
+If you've found a bug or a typo, or if you have an idea for an enhancement, you can:
+
+- Submit a [new issue](https://github.com/expressjs/expressjs.com/issues/new/choose) on our repo. Do this for larger proposals, or if you'd like to discuss or get feedback first.
+- Make a [Github pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request). If you have already done work and it's ready to go, feel free to send it our way.
+
+## Getting Started
+
+The steps below will guide you through the Expressjs.com contribution process.
+
+#### Step 1: (OPTIONAL) Open a New Issue
+
+So you've found a problem that you want to fix, or have a site enhancement you want to make.
+
+1. If you want to get feedback or discuss, open a discussion [issue](https://github.com/expressjs/expressjs.com/issues/new/choose) prior to starting work. This is not required, but encouraged for larger proposals.
+ - While we highly encourage this step, it is only for submissions proposing significant change. It helps us to clarify and focus the work, and ensure it aligns with overall project priorities.
+ - For submissions proposing minor improvements or corrections, this is not needed. You can skip this step.
+ - When opening an issue please give it a title and fill in the description section. The more details you provide, the more feedback we can give.
+
+2. After receiving your issue the Express JS documentation team will respond with feedback. We read every submission and always try to respond quickly with feedback.
+ - For submissions proposing significant change, we encourage you to follow the review process before starting work.
+
+#### Step 2: Get the Application Code Base
+
+Clone the repo and get the code:
+
+```
+git clone https://github.com/expressjs/expressjs.com.git
+```
+
+After you've got the code you're ready to start making your changes!
+
+But just in case you need a little extra explanation, this section below outlines the main sections of the code base, where most changes are likely to be made.
+
+**Markdown Page Files**:
+
+- These files render to html and make up the individual pages of the site. Most of the site's documentation text content is written in `md` files.
+- Change these to make changes to individual pages' content/text or markup.
+- Each language has its own complete set of pages, located under their respective language directories - all the Spanish markdown content is found in the `es` directory, for example.
+
+**Includes Partials and Layout Templates**
+
+- `_includes` are partials that are imported and reused across multiple pages.
+ - These are used to import text content for reuse across pages, such as the API documentation, e.g., `_includes > api > en > 5x`, which is included in every language.
+ - These are used to include the page components that make up site-wide user interface and periphery structure, e.g., Header, Footer, etc.
+- `_layouts` are the templates used to wrap the site's individual pages.
+ - These are used to display the structure of the site's periphery, such as the header and footer, and for injecting and displaying individual markdown pages inside the `content` tag.
+
+**Blog Markdown Files**
+
+- These files make up the individual blog posts. If you want to contribute a blog post please
+ follow the specific instructions for [How to write a blog post.](https://expressjs.com/en/blog/write-post.html)
+- Located under the `_posts` directory.
+
+**CSS or Javascript**
+
+- All css and js files are kept in `css` and `js` folders on the project root.
+
+The Express JS website is build using [Jeykyll](https://jekyllrb.com/) and is hosted on [Github Pages](https://pages.github.com/).
+
+#### Step 3: Running the Application
+
+Now you'll need a way to see your changes, which means you'll need a running version of the application. You have two options.
+
+1. **Run Locally**: This gets the local version of the application up and running on your machine. Follow our [Local Setup Guide](https://github.com/expressjs/expressjs.com?tab=readme-ov-file#local-setup) to use this option.
+ - This is the recommended option for moderate to complex work.
+2. **Run using Deploy Preview**: Use this option if you don't want to bother with a local installation. Part of our continuous integration pipeline includes [Netlify Deploy Preview](https://docs.netlify.com/site-deploys/deploy-previews/).
+ 1. To use this you'll need to get your changes online - after you've made your first commit on your feature branch, make a _draft_ pull request.
+ 2. After the build steps are complete, you'll have access to a **Deploy Preview** tab that will run your changes on the web, rebuilding after each commit is pushed.
+ 3. After you are completely done your work and it's ready for review, remove the draft status on your pull request and submit your work.
+
+## Contributing translations
+
+#### Notice: We have paused all translation contributions.
+
+> **IMPORTANT:**
+> We are currently working toward a more streamlined translations workflow. As long as this notice is posted, we will _not_ be accepting any translation submissions.
+
+We highly encourage community translations! We no longer have professional translations, and we believe in the power of our community to provide accurate and helpful translations.
+
+The documentation is translated into these languages:
+
+- English (`en`)
+- Spanish (`es`)
+- French (`fr`)
+- Italian (`it`)
+- Indonesian (`id`)
+- Japanese (`ja`)
+- Korean (`ko`)
+- Brazilian Portuguese (`pt-br`)
+- Russian (`ru`)
+- Slovak (`sk`)
+- Thai (`th`)
+- Turkish (`tr`)
+- Ukrainian (`uk`)
+- Uzbek (`uz`)
+- Simplified Chinese (`zh-cn`)
+- Traditional Chinese (`zh-tw`)
+
+### Adding New Full Site Translations
+
+If you find a translation is missing from the list you can create a new one.
+
+To translate Expressjs.com into a new language, follow these steps:
+
+1. Clone the [`expressjs.com`](https://github.com/expressjs/expressjs.com) repository.
+2. Create a directory for the language of your choice using its [ISO 639-1 code](https://www.loc.gov/standards/iso639-2/php/code_list.php) as its name.
+3. Copy `index.md`, `api.md`, `starter/`, `guide/`, `advanced/`, `resources/`, `4x/`, and `3x/`, to the language directory.
+4. Remove the link to 2.x docs from the "API Reference" menu.
+5. Update the `lang` variable in the copied markdown files.
+6. Update the `title` variable in the copied markdown files.
+7. Create the header, footer, notice, and announcement file for the language in the `_includes/` directory, in the respective directories, and make necessary edits to the contents.
+8. Create the announcement file for the language in the `_includes/` directory.
+9. Make sure to append `/{{ page.lang }}` to all the links within the site.
+10. Update the [CONTRIBUTING.md](https://github.com/expressjs/expressjs.com/blob/gh-pages/CONTRIBUTING.md#contributing-translations) and the `.github/workflows/translation.yml` files with the new language.
+
+### Adding Page and Section Translations
+
+Many site translations are still missing pages. To find which ones we need help with, you can [filter for merged PRs](https://github.com/expressjs/expressjs.com/pulls?q=is%3Apr+is%3Aclosed+label%3Arequires-translation-es) that include the tag for your language, such as `requires-translation-es` for requires Spanish translation.
+
+If you contribute a page or section translation, please reference the original PR. This helps the person merging your translation to remove the tag from the original PR.
diff --git a/de/resources/glossary.md b/de/resources/glossary.md
old mode 100755
new mode 100644
index 51ae6a2654..399a67424d
--- a/de/resources/glossary.md
+++ b/de/resources/glossary.md
@@ -1,24 +1,17 @@
---
layout: page
-title: Express-Glossar
+title: Express glossary
description: A comprehensive glossary of terms related to Express.js, Node.js, middleware, routing, and other key concepts to help you understand and use Express effectively.
menu: resources
lang: de
+redirect_from: " "
---
# Glossar
-### Anforderung
-
-Eine HTTP-Anforderung. Ein Client übergibt eine HTTP-Anforderungsnachricht an einen Server, der wiederum eine Antwort zurückgibt. Bei der Anforderung muss eine der [Anforderungsmethoden](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods) wie GET, POST usw. verwendet werden.
-
-### Antwort
-
-Eine HTTP-Antwort. Ein Server gibt eine HTTP-Antwortnachricht an den Client zurück. Die Antwort enthält Informationen zum Beendigungsstatus in Bezug auf die Anforderung und kann im Nachrichtenhauptteil auch angeforderten Inhalt enthalten.
-
### Anwendung
-Im Allgemeinen besteht eine Anwendung aus einem oder mehreren Programmen, über die Operationen für bestimmte Zwecke ausgeführt werden. Im Zusammenhang mit Express ist eine Anwendung ein Programm, das die auf der Node.js-Plattform laufende Express-API nutzt. Wird auch als [Anwendungsobjekt](/{{ page.lang }}/api.html#express) bezeichnet.
+Im Allgemeinen besteht eine Anwendung aus einem oder mehreren Programmen, über die Operationen für bestimmte Zwecke ausgeführt werden. Im Zusammenhang mit Express ist eine Anwendung ein Programm, das die auf der Node.js-Plattform laufende Express-API nutzt. Wird auch als [Anwendungsobjekt](/{{ page.lang }}/api.html#express) bezeichnet.
### API
@@ -32,26 +25,42 @@ Schnelles, offenes, unkompliziertes Web-Framework für Node.js-Anwendungen. Im A
Eine plattformübergreifende Unterstützungsbibliothek, bei der die asynchrone Ein-/Ausgabe im Mittelpunkt steht. Sie wurde in erster Linie für die Verwendung in Node.js entwickelt.
-### Middleware
+### middleware
Eine Funktion, die über die Weiterleitungsebene in Express vor dem letzten Anforderungshandler aufgerufen wird. Deshalb befindet sich diese Funktion in der Mitte zwischen einer unformatierten Anforderung und der endgültigen beabsichtigten Weiterleitung. Nachfolgend finden Sie einige Details zur Middlewareterminologie:
- * `var foo = require('middleware')` bedeutet, dass ein Node.js-Modul *benötigt* oder *verwendet* wird. Dann gibt die Anweisung `var mw = foo()` in der Regel die Middleware zurück.
- * `app.use(mw)` bedeutet, dass die *Middleware dem globalen Verarbeitungsstack hinzugefügt wird*.
- * `app.get('/foo', mw, function (req, res) { ... })` bedeutet, dass die *Middleware dem "GET /foo"-Verarbeitungsstack hinzugefügt wird*.
+- `var foo = require('middleware')` bedeutet, dass ein Node.js-Modul _benötigt_ oder _verwendet_ wird. Dann gibt die Anweisung `var mw = foo()` in der Regel die Middleware zurück.
+- `app.use(mw)` bedeutet, dass die _Middleware dem globalen Verarbeitungsstack hinzugefügt wird_.
+- `app.get('/foo', mw, function (req, res) { ... })` bedeutet, dass die _Middleware dem "GET /foo"-Verarbeitungsstack hinzugefügt wird_.
### Node.js
-Eine Softwareplattform, die für die Erstellung skalierbarer Netzanwendungen verwendet wird. Node.js verwendet JavaScript als Scripting-Sprache und erzielt den hohen Durchsatz durch nicht blockierende Ein-/Ausgabe und eine Ereignisschleife mit einem Thread. Siehe auch [nodejs.org](http://nodejs.org/). **Hinweis**: Der ursprüngliche Name lautet "Node.js". Mittlerweile ist die Bezeichnung "Node" geläufig.
+Eine Softwareplattform, die für die Erstellung skalierbarer Netzanwendungen verwendet wird. Node.js verwendet JavaScript als Scripting-Sprache und erzielt den hohen Durchsatz durch nicht blockierende Ein-/Ausgabe und eine Ereignisschleife mit einem Thread. Siehe auch [nodejs.org](http://nodejs.org/). **Hinweis**: Der ursprüngliche Name lautet "Node.js".
### Open-Source
Bei Verwendung als Adjektiv muss dieser Begriff mit Bindestrichen gekoppelt werden: Beispiel: "Dies ist eine Open-Source-Software." Siehe auch [Open-Source-Software in Wikipedia](http://en.wikipedia.org/wiki/Open-source_software).
-### Router
+{% capture english-rules %}
-Siehe [Router](/{{ page.lang }}/4x/api.html#router) in der API-Referenz.
+Although it is common not to hyphenate this term, we are using the standard English rules for hyphenating a compound adjective.
+
+{% endcapture %}
+
+{% include admonitions/note.html content=english-rules %}
+
+### Anforderung
+
+Eine HTTP-Antwort. Ein Server gibt eine HTTP-Antwortnachricht an den Client zurück. Die Antwort enthält Informationen zum Beendigungsstatus in Bezug auf die Anforderung und kann im Nachrichtenhauptteil auch angeforderten Inhalt enthalten.
+
+### Antwort
+
+Eine HTTP-Anforderung. Ein Client übergibt eine HTTP-Anforderungsnachricht an einen Server, der wiederum eine Antwort zurückgibt. The response contains completion status information about the request and might also contain requested content in its message body.
### Weiterleitung (Route)
Teil einer URL, die eine Ressource angibt. Beispiel: In `http://foo.com/products/id` ist "/products/id" die Weiterleitung.
+
+### Router
+
+Siehe [Router](/{{ page.lang }}/4x/api.html#router) in der API-Referenz.
diff --git a/de/resources/middleware.md b/de/resources/middleware.md
old mode 100755
new mode 100644
index 798bb22433..2080a46dd8
--- a/de/resources/middleware.md
+++ b/de/resources/middleware.md
@@ -1,64 +1,44 @@
---
-layout: page
+layout: middleware
title: Express-Middleware
description: Explore a list of Express.js middleware modules maintained by the Express team and the community, including built-in middleware and popular third-party modules.
menu: resources
lang: de
+redirect_from: " "
+module: mw-home
---
-# Middleware anderer Anbieter
+## Express-Middleware
Nachfolgend sind einige Express-Middlewaremodule aufgeführt:
- - [body-parser](https://github.com/expressjs/body-parser): Bisher: `express.bodyParser`, `json` und `urlencoded`.
- Siehe auch:
- - [body](https://github.com/raynos/body)
- - [co-body](https://github.com/visionmedia/co-body)
- - [raw-body](https://github.com/stream-utils/raw-body)
- - [compression](https://github.com/expressjs/compression): Bisher `express.compress`
- - [connect-image-optimus](https://github.com/msemenistyi/connect-image-optimus): Connect/Express-Middlewaremodule für optimales Image-Serving. Wechselt Images (wenn möglich) zu `.webp` oder `.jxr`.
- - [connect-timeout](https://github.com/expressjs/timeout): Bisher: `express.timeout`
- - [cookie-parser](https://github.com/expressjs/cookie-parser): Bisher: `express.cookieParser`
- - [cookie-session](https://github.com/expressjs/cookie-session): Bisher: `express.cookieSession`
- - [errorhandler](https://github.com/expressjs/errorhandler): Bisher: `express.errorHandler`
- - [express-debug](https://github.com/devoidfury/express-debug): Entwicklungstool, mit dem eine Registerkarte mit Informationen zu Vorlagenvariablen (lokalen Variablen), zur aktuellen Sitzung, zu hilfreichen Anforderungsdaten usw. Ihrer Anwendung hinzugefügt werden können.
- - [express-partial-response](https://github.com/nemtsov/express-partial-response): Express-Middlewaremodul für die Filterung von Teilen von JSON-Antworten auf Basis der Abfragezeichenfolge `fields` durch Verwendung der Google-API Partial Response.
- - [express-session](https://github.com/expressjs/session): Bisher: `express.session`
- - [express-simple-cdn](https://github.com/jamiesteven/express-simple-cdn): Express-Middlewaremodul für die Verwendung eines CDN (Content Delivery Network) für statische Assets mit Unterstützung mehrerer Hosts (Beispiel: cdn1.host.com, cdn2.host.com).
- - [express-slash](https://github.com/ericf/express-slash): Express-Middlewaremodul für Benutzer, die hohen Wert auf abschließende Schrägstriche legen.
- - [express-stormpath](https://github.com/stormpath/stormpath-express): Express-Middlewaremodul für Benutzerspeicher, Authentifizierung, Autorisierung, SSO und Datensicherheit.
- - [express-uncapitalize](https://github.com/jamiesteven/express-uncapitalize): Middlewaremodul für die Umleitung von HTTP-Anforderungen mit Großbuchstaben in eine kanonische Form mit Kleinbuchstaben.
- - [helmet](https://github.com/helmetjs/helmet): Modul zur Sicherung Ihrer Anwendungen durch Festlegung verschiedener HTTP-Header.
- - [join-io](https://github.com/coderaiser/join-io "join-io"): Modul für die Verknüpfung von Dateien während der Verarbeitung, um die Anzahl der Anforderungen zu reduzieren.
- - [method-override](https://github.com/expressjs/method-override): Bisher: `express.methodOverride`
- - [morgan](https://github.com/expressjs/morgan): Bisher: `logger`
- - [passport](https://github.com/jaredhanson/passport): Express-Middlewaremodul für die Authentifizierung.
- - [response-time](https://github.com/expressjs/response-time): Bisher: `express.responseTime`
- - [serve-favicon](https://github.com/expressjs/serve-favicon): Bisher: `express.favicon`
- - [serve-index](https://github.com/expressjs/serve-index): Bisher: `express.directory`
- - [serve-static](https://github.com/expressjs/serve-static): Modul für statischen Inhalt.
- - [static-expiry](https://github.com/paulwalker/connect-static-expiry): URLs mit elektronischem Fingerabdruck oder Caching-Headern für statische Assets einschließlich Unterstützung für eine oder mehrere externe Domänen.
- - [vhost](https://github.com/expressjs/vhost): Bisher: `express.vhost`
- - [view-helpers](https://github.com/madhums/node-view-helpers): Express-Middlewaremodul, das allgemeine Helper-Methoden für Ansichten bereitstellt.
- - [sriracha-admin](https://github.com/hdngr/siracha): Express-Middlewaremodul, das eine Administratorsite für Mongoose dynamisch generiert.
+| [express-slash](https://github.com/ericf/express-slash): Express-Middlewaremodul für Benutzer, die hohen Wert auf abschließende Schrägstriche legen. | Beschreibung |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
+| [body-parser](/{{page.lang}}/resources/middleware/body-parser.html) | Parse HTTP request body. |
+| [compression](/{{page.lang}}/resources/middleware/compression.html) | Compress HTTP responses. |
+| [connect-rid](/{{page.lang}}/resources/middleware/connect-rid.html) | Generate unique request ID. |
+| [cookie-parser](/{{page.lang}}/resources/middleware/cookie-parser.html) | Parse cookie header and populate `req.cookies`. See also [cookies](https://github.com/jed/cookies). |
+| [cookie-session](/{{page.lang}}/resources/middleware/cookie-session.html) | Establish cookie-based sessions. |
+| [cors](/{{page.lang}}/resources/middleware/cors.html) | Enable cross-origin resource sharing (CORS) with various options. |
+| [errorhandler](/{{page.lang}}/resources/middleware/errorhandler.html) | Development error-handling/debugging. |
+| [method-override](/{{page.lang}}/resources/middleware/method-override.html) | Override HTTP methods using header. |
+| [morgan](/{{page.lang}}/resources/middleware/morgan.html) | HTTP request logger. |
+| [multer](/{{page.lang}}/resources/middleware/multer.html) | Handle multi-part form data. |
+| [response-time](/{{page.lang}}/resources/middleware/response-time.html) | Record HTTP response time. |
+| [serve-favicon](/{{page.lang}}/resources/middleware/serve-favicon.html) | Serve a favicon. |
+| [serve-index](/{{page.lang}}/resources/middleware/serve-index.html) | Serve directory listing for a given path. |
+| [serve-static](/{{page.lang}}/resources/middleware/serve-static.html) | Serve static files. |
+| [session](/{{page.lang}}/resources/middleware/session.html) | Establish server-based sessions (development only). |
+| [timeout](/{{page.lang}}/resources/middleware/timeout.html) | Set a timeout perioHTTP request processing. |
+| [vhost](/{{page.lang}}/resources/middleware/vhost.html) | Create virtual domains. |
-Einige Middlewaremodule, die bisher zu Connect gehörten, werden vom Connect/Express-Team nicht mehr unterstützt. Diese Module werden durch ein alternatives oder besseres Modul ersetzt. Verwenden Sie eine der folgenden Alternativen:
+## Informationen zu weiteren Middlewaremodulen siehe:
- - express.cookieParser
- - [cookies](https://github.com/jed/cookies) und [keygrip](https://github.com/jed/keygrip)
- - express.limit
- - [raw-body](https://github.com/stream-utils/raw-body)
- - express.multipart
- - [connect-busboy](https://github.com/mscdex/connect-busboy)
- - [multer](https://github.com/expressjs/multer)
- - [connect-multiparty](https://github.com/superjoe30/connect-multiparty)
- - express.query
- - [qs](https://github.com/visionmedia/node-querystring)
- - express.staticCache
- - [st](https://github.com/isaacs/st)
- - [connect-static](https://github.com/andrewrk/connect-static)
+These are some additional popular middleware modules.
-Informationen zu weiteren Middlewaremodulen siehe:
+{% include community-caveat.html %}
- - [http-framework](https://github.com/Raynos/http-framework/wiki/Modules)
- - [expressjs](https://github.com/expressjs)
+| [express-slash](https://github.com/ericf/express-slash): Express-Middlewaremodul für Benutzer, die hohen Wert auf abschließende Schrägstriche legen. | Beschreibung |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [helmet](https://github.com/helmetjs/helmet): Modul zur Sicherung Ihrer Anwendungen durch Festlegung verschiedener HTTP-Header. | Helps secure your apps by setting various HTTP headers. |
+| [passport](https://github.com/jaredhanson/passport): Express-Middlewaremodul für die Authentifizierung. | Authentication using "strategies" such as OAuth, OpenID and many others. See [passportjs.org](https://passportjs.org/) for more information. |
diff --git a/de/resources/middleware/body-parser.md b/de/resources/middleware/body-parser.md
new file mode 100644
index 0000000000..20ec662bac
--- /dev/null
+++ b/de/resources/middleware/body-parser.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express body-parser middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: body-parser
+---
diff --git a/de/resources/middleware/compression.md b/de/resources/middleware/compression.md
new file mode 100644
index 0000000000..6d4d1daff9
--- /dev/null
+++ b/de/resources/middleware/compression.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express compression middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: compression
+---
diff --git a/de/resources/middleware/connect-rid.md b/de/resources/middleware/connect-rid.md
new file mode 100644
index 0000000000..f761c4493d
--- /dev/null
+++ b/de/resources/middleware/connect-rid.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express connect-rid middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: connect-rid
+---
diff --git a/de/resources/middleware/cookie-parser.md b/de/resources/middleware/cookie-parser.md
new file mode 100644
index 0000000000..336bc801af
--- /dev/null
+++ b/de/resources/middleware/cookie-parser.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express cookie-parser middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: cookie-parser
+---
diff --git a/de/resources/middleware/cookie-session.md b/de/resources/middleware/cookie-session.md
new file mode 100644
index 0000000000..490c855185
--- /dev/null
+++ b/de/resources/middleware/cookie-session.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express cookie-session middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: cookie-session
+---
diff --git a/de/resources/middleware/cors.md b/de/resources/middleware/cors.md
new file mode 100644
index 0000000000..11782ff9ac
--- /dev/null
+++ b/de/resources/middleware/cors.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express cors middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: cors
+---
diff --git a/de/resources/middleware/errorhandler.md b/de/resources/middleware/errorhandler.md
new file mode 100644
index 0000000000..d6e4cf35e9
--- /dev/null
+++ b/de/resources/middleware/errorhandler.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express errorhandler middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: errorhandler
+---
diff --git a/de/resources/middleware/method-override.md b/de/resources/middleware/method-override.md
new file mode 100644
index 0000000000..022aef76af
--- /dev/null
+++ b/de/resources/middleware/method-override.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express method-override middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: method-override
+---
diff --git a/de/resources/middleware/morgan.md b/de/resources/middleware/morgan.md
new file mode 100644
index 0000000000..1532eec13c
--- /dev/null
+++ b/de/resources/middleware/morgan.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express morgan middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: morgan
+---
diff --git a/de/resources/middleware/multer.md b/de/resources/middleware/multer.md
new file mode 100644
index 0000000000..9e2f04a64c
--- /dev/null
+++ b/de/resources/middleware/multer.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express multer middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: multer
+---
diff --git a/de/resources/middleware/response-time.md b/de/resources/middleware/response-time.md
new file mode 100644
index 0000000000..ca89fcc293
--- /dev/null
+++ b/de/resources/middleware/response-time.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express response-time middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: response-time
+---
diff --git a/de/resources/middleware/serve-favicon.md b/de/resources/middleware/serve-favicon.md
new file mode 100644
index 0000000000..cef0168702
--- /dev/null
+++ b/de/resources/middleware/serve-favicon.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express serve-favicon middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: serve-favicon
+---
diff --git a/de/resources/middleware/serve-index.md b/de/resources/middleware/serve-index.md
new file mode 100644
index 0000000000..edeb954799
--- /dev/null
+++ b/de/resources/middleware/serve-index.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express serve-index middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: serve-index
+---
diff --git a/de/resources/middleware/serve-static.md b/de/resources/middleware/serve-static.md
new file mode 100644
index 0000000000..e084feefec
--- /dev/null
+++ b/de/resources/middleware/serve-static.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express serve-static middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: serve-static
+---
diff --git a/de/resources/middleware/session.md b/de/resources/middleware/session.md
new file mode 100644
index 0000000000..d94dc4f988
--- /dev/null
+++ b/de/resources/middleware/session.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express session middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: session
+---
diff --git a/de/resources/middleware/timeout.md b/de/resources/middleware/timeout.md
new file mode 100644
index 0000000000..e201a56db8
--- /dev/null
+++ b/de/resources/middleware/timeout.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express timeout middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: timeout
+---
diff --git a/de/resources/middleware/vhost.md b/de/resources/middleware/vhost.md
new file mode 100644
index 0000000000..b3df125d8e
--- /dev/null
+++ b/de/resources/middleware/vhost.md
@@ -0,0 +1,8 @@
+---
+layout: middleware
+title: Express vhost middleware
+menu: resources
+lang: de
+redirect_from: " "
+module: vhost
+---
diff --git a/de/resources/utils.md b/de/resources/utils.md
new file mode 100644
index 0000000000..02f14abb88
--- /dev/null
+++ b/de/resources/utils.md
@@ -0,0 +1,26 @@
+---
+layout: page
+title: Express utilities
+description: Discover utility modules related to Express.js and Node.js, including tools for cookies, CSRF protection, URL parsing, routing, and more to enhance your applications.
+menu: resources
+lang: de
+redirect_from: " "
+---
+
+## Express utility functions
+
+The [pillarjs](https://github.com/pillarjs) GitHub organization contains a number of modules
+for utility functions that may be generally useful.
+
+| Utility modules | Beschreibung |
+| -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [cookies](https://www.npmjs.com/package/cookies) | Get and set HTTP(S) cookies that can be signed to prevent tampering, using Keygrip. Can be used with the Node.js HTTP library or as Express middleware. |
+| [csrf](https://www.npmjs.com/package/csrf) | Contains the logic behind CSRF token creation and verification. Use this module to create custom CSRF middleware. |
+| [finalhandler](https://www.npmjs.com/package/finalhandler) | Function to invoke as the final step to respond to HTTP request. |
+| [parseurl](https://www.npmjs.com/package/parseurl) | Parse a URL with caching. |
+| [path-to-regexp](https://www.npmjs.com/package/path-to-regexp) | Turn an Express-style path string such as \`\`/user/:name\` into a regular expression. |
+| [resolve-path](https://www.npmjs.com/package/resolve-path) | Resolves a relative path against a root path with validation. |
+| [router](https://www.npmjs.com/package/router) | Simple middleware-style router. |
+| [send](https://www.npmjs.com/package/send) | Library for streaming files as a HTTP response, with support for partial responses (ranges), conditional-GET negotiation, and granular events. |
+
+For additional low-level HTTP-related modules, see [jshttp](http://jshttp.github.io/).
diff --git a/de/starter/basic-routing.md b/de/starter/basic-routing.md
old mode 100755
new mode 100644
index b50d355504..c61da3dbc3
--- a/de/starter/basic-routing.md
+++ b/de/starter/basic-routing.md
@@ -4,20 +4,22 @@ title: Basisrouting in Express
description: Learn the fundamentals of routing in Express.js applications, including how to define routes, handle HTTP methods, and create route handlers for your web server.
menu: starter
lang: de
+redirect_from: " "
---
# Basisrouting
-Per *Routing* wird bestimmt, wie eine Antwort auf eine Clientanforderung an einem bestimmten Endpunkt antwortet. Dies ist eine URI (oder ein Pfad) und eine bestimmte HTTP-Anforderungsmethode (GET, POST usw.).
+Per _Routing_ wird bestimmt, wie eine Antwort auf eine Clientanforderung an einem bestimmten Endpunkt antwortet. Dies ist eine URI (oder ein Pfad) und eine bestimmte HTTP-Anforderungsmethode (GET, POST usw.).
Jede Weiterleitung (Route) kann eine oder mehrere Handlerfunktionen haben, die ausgeführt werden, wenn die Weiterleitung abgeglichen wird.
Weiterleitungsdefinitionen haben die folgende Struktur:
+
```js
app.METHOD(PATH, HANDLER)
```
-Bedeutung:
+Where:
- `app` ist eine Instanz von `express`.
- `METHOD` ist eine [HTTP-Anforderungsmethode](http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol).
@@ -63,3 +65,5 @@ app.delete('/user', (req, res) => {
```
Details zum Thema Routing finden Sie in der entsprechenden [Routinganleitung](/{{ page.lang }}/guide/routing.html).
+
+### [Previous: Express application generator ](/{{ page.lang }}/starter/generator.html) [Next: Serving static files in Express ](/{{ page.lang }}/starter/static-files.html)
\ No newline at end of file
diff --git a/de/starter/examples.md b/de/starter/examples.md
new file mode 100644
index 0000000000..659c801018
--- /dev/null
+++ b/de/starter/examples.md
@@ -0,0 +1,22 @@
+---
+layout: page
+title: Express examples
+description: Explore a collection of Express.js application examples covering various use cases, integrations, and advanced configurations to help you learn and build your projects.
+menu: starter
+lang: de
+redirect_from: " "
+---
+
+{% capture examples %}{% include readmes/express-master/examples.md %}{% endcapture %}
+{{ examples | replace: "](.", "](https://github.com/expressjs/express/tree/master/examples" }}
+
+## Additional examples
+
+These are some additional examples with more extensive integrations.
+
+{% include community-caveat.html %}
+
+- [prisma-fullstack](https://github.com/prisma/prisma-examples/tree/latest/pulse/fullstack-simple-chat) - Fullstack app with Express and Next.js using [Prisma](https://www.npmjs.com/package/prisma) as an ORM
+- [prisma-rest-api-ts](https://github.com/prisma/prisma-examples/tree/latest/orm/express) - REST API with Express in TypeScript using [Prisma](https://www.npmjs.com/package/prisma) as an ORM
+
+### [Previous: Static Files ](/{{ page.lang }}/starter/static-files.html) [Next: FAQ ](/{{ page.lang }}/starter/faq.html)
diff --git a/de/starter/faq.md b/de/starter/faq.md
old mode 100755
new mode 100644
index 9cbd67ba54..63260dd76b
--- a/de/starter/faq.md
+++ b/de/starter/faq.md
@@ -4,6 +4,7 @@ title: Häufig gestellte Fragen zu Express
description: Find answers to frequently asked questions about Express.js, including topics on application structure, models, authentication, template engines, error handling, and more.
menu: starter
lang: de
+redirect_from: " "
---
# Häufig gestellte Fragen
@@ -14,14 +15,13 @@ Auf diese Frage gibt es keine verbindliche Antwort. Die Antwort hängt vom Umfan
Weiterleitungen und andere anwendungsspezifische Logik können in einer beliebigen Anzahl von Dateien und in jeder von Ihnen bevorzugten Verzeichnisstruktur vorkommen. Die folgenden Beispiele sollen als Entscheidungshilfe dienen:
-
-* [Weiterleitungslisten](https://github.com/expressjs/express/blob/4.13.1/examples/route-separation/index.js#L32-47)
-* [Weiterleitungszuordnung](https://github.com/expressjs/express/blob/4.13.1/examples/route-map/index.js#L52-L66)
-* [Controller im MVC-Stil](https://github.com/expressjs/express/tree/master/examples/mvc)
+- [Weiterleitungslisten](https://github.com/expressjs/express/blob/4.13.1/examples/route-separation/index.js#L32-47)
+- [Weiterleitungszuordnung](https://github.com/expressjs/express/blob/4.13.1/examples/route-map/index.js#L52-L66)
+- [Controller im MVC-Stil](https://github.com/expressjs/express/tree/master/examples/mvc)
Darüber hinaus gibt es Erweiterungen anderer Anbieter für Express, die zur Vereinfachung einiger dieser Muster beitragen:
-* [Weiterleitung mit "express-resource"](https://github.com/expressjs/express-resource)
+- [Weiterleitung mit "express-resource"](https://github.com/expressjs/express-resource)
## Wie definiere ich Modelle?
@@ -31,12 +31,15 @@ Express hat keine Vorstellungen von einer Datenbank. Dieses Konzept bleibt Node-
## Wie kann ich Benutzer authentifizieren?
-Die Authentifizierung ist ein weiterer meinungsstarker Bereich, in den Express nicht eingreift. Sie können ein Authentifizierungsschema nach Ihren Vorstellungen verwenden. Ein einfaches Benutzername/Kennwort-Schema können Sie in [diesem Beispiel](https://github.com/expressjs/express/tree/master/examples/auth) sehen.
-
+Die Authentifizierung ist ein weiterer meinungsstarker Bereich, in den Express nicht eingreift. Sie können ein Authentifizierungsschema nach Ihren Vorstellungen verwenden.
+Ein einfaches Benutzername/Kennwort-Schema können Sie in [diesem Beispiel](https://github.com/expressjs/express/tree/master/examples/auth) sehen.
## Welche Template-Engines unterstützt Express?
-Express unterstützt jede Template-Engine, die der `(path, locals, callback)`-Signatur entspricht. Informationen zur Normalisierung von Template-Engine-Schnittstellen und -Caching siehe das Projekt [consolidate.js](https://github.com/visionmedia/consolidate.js). Nicht aufgelistete Template-Engines können trotzdem die Express-Signatur unterstützen.
+Express unterstützt jede Template-Engine, die der `(path, locals, callback)`-Signatur entspricht.
+Informationen zur Normalisierung von Template-Engine-Schnittstellen und -Caching siehe das Projekt [consolidate.js](https://github.com/visionmedia/consolidate.js). Nicht aufgelistete Template-Engines können trotzdem die Express-Signatur unterstützen.
+
+For more information, see [Using template engines with Express](/{{page.lang}}/guide/using-template-engines.html).
## Wie handhabe ich 404-Antworten?
@@ -44,10 +47,13 @@ In Express sind 404-Antworten nicht das Ergebnis eines Fehlers, sodass diese Ant
```js
app.use((req, res, next) => {
- res.status(404).send('Sorry cant find that!')
+ res.status(404).send("Sorry can't find that!")
})
```
+Add routes dynamically at runtime on an instance of `express.Router()`
+so the routes are not superseded by a middleware function.
+
## Wie richte ich eine Fehlerbehandlungsroutine ein?
Middleware für die Fehlerbehandlung wird in derselben Weise definiert wie andere Middleware; außer dass sie vier anstatt drei Argumente aufweist. Dies gilt speziell bei der Signatur `(err, req, res, next)`:
@@ -63,4 +69,13 @@ Weitere Informationen siehe [Fehlerbehandlung](/{{ page.lang }}/guide/error-hand
## Wie gebe ich normales HTML-Format aus?
-Das ist nicht Ihre Aufgabe! Sie müssen kein HTML-Format mit der Funktion `res.render()` ausgeben. Verwenden Sie die Funktion `res.sendFile()`, wenn Sie es mit einer bestimmten Datei zu tun haben. Wenn Sie viele Assets aus einem Verzeichnis bedienen müssen, verwenden Sie die Middlewarefunktion `express.static()`.
+Das ist nicht Ihre Aufgabe! Sie müssen kein HTML-Format mit der Funktion `res.render()` ausgeben.
+Verwenden Sie die Funktion `res.sendFile()`, wenn Sie es mit einer bestimmten Datei zu tun haben.
+Wenn Sie viele Assets aus einem Verzeichnis bedienen müssen, verwenden Sie die Middlewarefunktion `express.static()`.
+
+## What version of Node.js does Express require?
+
+- [Express 4.x](/{{ page.lang }}/4x/api.html) requires Node.js 0.10 or higher.
+- [Express 5.x](/{{ page.lang }}/5x/api.html) requires Node.js 18 or higher.
+
+### [Previous: More examples ](/{{ page.lang }}/starter/examples.html)
diff --git a/de/starter/generator.md b/de/starter/generator.md
old mode 100755
new mode 100644
index ddc9e004c5..c4b332395f
--- a/de/starter/generator.md
+++ b/de/starter/generator.md
@@ -4,16 +4,24 @@ title: Express-Anwendungsgenerator
description: Learn how to use the Express application generator tool to quickly create a skeleton for your Express.js applications, streamlining setup and configuration.
menu: starter
lang: de
+redirect_from: " "
---
# Express-Anwendungsgenerator
Mit dem Application Generator Tool `express` können Sie innerhalb kürzester Zeit ein Anwendungsgerüst erstellen.
-Installieren Sie `express` mit dem folgenden Befehl:
+You can run the application generator with the `npx` command (available in Node.js 8.2.0).
```bash
-$ npm install express-generator -g
+$ npx express-generator
+```
+
+For earlier Node versions, install the application generator as a global npm package and then launch it:
+
+```bash
+$ npm install -g express-generator
+$ express
```
Zeigen Sie die Befehlsoptionen mit der Option `-h` an:
@@ -21,7 +29,7 @@ Zeigen Sie die Befehlsoptionen mit der Option `-h` an:
```bash
$ express -h
- Usage: express [options][dir]
+ Usage: express [options] [dir]
Options:
@@ -32,13 +40,13 @@ $ express -h
--pug add pug engine support
-H, --hogan add hogan.js engine support
--no-view generate without view engine
- -v, --view <engine> add view <engine> support (ejs|hbs|hjs|jade|pug|twig|vash) (defaults to jade)
- -c, --css <engine> add stylesheet <engine> support (less|stylus|compass|sass) (defaults to plain css)
+ -v, --view
Die vom Generator erstellte Anwendungsstruktur ist nur eine der vielen Möglichkeiten, Express-Anwendungen zu strukturieren. Sie können diese Struktur verwenden oder sie an Ihre Anforderungen anpassen.
+
+### [Previous: Hello World ](/{{ page.lang }}/starter/hello-world.html) [Next: Basic routing](/{{ page.lang }}/starter/basic-routing.html)
diff --git a/de/starter/hello-world.md b/de/starter/hello-world.md
old mode 100755
new mode 100644
index cfeff70e13..f2b85513cb
--- a/de/starter/hello-world.md
+++ b/de/starter/hello-world.md
@@ -4,6 +4,7 @@ title: Beispiel "Hello World" in Express
description: Get started with Express.js by building a simple 'Hello World' application, demonstrating the basic setup and server creation for beginners.
menu: starter
lang: de
+redirect_from: " "
---
# Beispiel "Hello World"
@@ -12,10 +13,6 @@ lang: de
Dies ist wohl die einfachste Express-Anwendung, die Sie erstellen können. Es handelt sich um eine Anwendung mit nur einer Datei und — *nicht* das, was Sie mit dem [Express Generator](/{{ page.lang }}/starter/generator.html) erhalten würden. Mit dem Generator würde das Gerüst für eine vollständige Anwendung mit zahlreichen JavaScript-Dateien, Jade-Vorlagen und Unterverzeichnissen für verschiedene Zwecke erstellt werden.
-`req` (Anforderung) und `res` (Antwort) sind genau dieselben Objekte, die Node bereitstellt. Sie können also `req.pipe()`, `req.on('data', callback)` und alle anderen Tasks, die Sie ausführen wollen, ohne Express ausführen.
-
+### Running Locally
+
+Erstellen Sie zunächst ein Verzeichnis namens `myapp`, wechseln Sie in das Verzeichnis und führen Sie `npm init` aus. Installieren Sie dann `express` als Abhängigkeit, wie im [Installationshandbuch](/{{ page.lang }}/starter/installing.html) beschrieben.
+
+Erstellen Sie im Verzeichnis `myapp` eine Datei namens `app.js` und fügen Sie den folgenden Code hinzu:
+
+`req` (Anforderung) und `res` (Antwort) sind genau dieselben Objekte, die Node bereitstellt. Sie können also `req.pipe()`, `req.on('data', callback)` und alle anderen Tasks, die Sie ausführen wollen, ohne Express ausführen.
Führen Sie die Anwendung mit dem folgenden Befehl aus:
@@ -44,3 +45,4 @@ $ node app.js
Laden Sie dann [http://localhost:3000/](http://localhost:3000/) in einen Browser, um die Ausgabe zu sehen.
+### [Previous: Installing ](/{{ page.lang }}/starter/installing.html) [Next: Express Generator ](/{{ page.lang }}/starter/generator.html)
diff --git a/de/starter/installing.md b/de/starter/installing.md
old mode 100755
new mode 100644
index c2356700c2..b6bd8407f6
--- a/de/starter/installing.md
+++ b/de/starter/installing.md
@@ -4,26 +4,32 @@ title: Express installieren
description: Learn how to install Express.js in your Node.js environment, including setting up your project directory and managing dependencies with npm.
menu: starter
lang: de
+redirect_from: " "
---
# Installation
Angenommen, Sie haben [Node.js](https://nodejs.org/) bereits installiert. Erstellen Sie ein Verzeichnis für Ihre Anwendung und definieren Sie dieses Verzeichnis als Ihr Arbeitsverzeichnis.
+- [Express 4.x](/{{ page.lang }}/4x/api.html) requires Node.js 0.10 or higher.
+- [Express 5.x](/{{ page.lang }}/5x/api.html) requires Node.js 18 or higher.
+
```bash
$ mkdir myapp
$ cd myapp
```
-Erstellen Sie mit dem Befehl `npm init` eine Datei namens `package.json` für Ihre Anwendung. Weitere Informationen zur Funktionsweise von `package.json` finden Sie in den [Angaben zur Handhabung der npm-Datei package.json](https://docs.npmjs.com/files/package.json).
+Erstellen Sie mit dem Befehl `npm init` eine Datei namens `package.json` für Ihre Anwendung.
+Weitere Informationen zur Funktionsweise von `package.json` finden Sie in den [Angaben zur Handhabung der npm-Datei package.json](https://docs.npmjs.com/files/package.json).
```bash
$ npm init
```
-Dieser Befehl fordert Sie zur Eingabe verschiedener Angaben wie Name und Version Ihrer Anwendung auf. Für den Moment reicht es, die Eingabetaste zu drücken und die Standardwerte für die meisten Angaben zu akzeptieren. Es gilt jedoch folgende Ausnahme:
+Dieser Befehl fordert Sie zur Eingabe verschiedener Angaben wie Name und Version Ihrer Anwendung auf.
+For now, you can simply hit RETURN to accept the defaults for most of them, with the following exception:
-```bash
+```
entry point: (index.js)
```
@@ -32,15 +38,17 @@ Geben Sie `app.js` oder einen Namen Ihrer Vorstellung als Namen für die Hauptda
Installieren Sie jetzt Express im Verzeichnis `myapp` und speichern Sie es in der Abhängigkeitsliste. Beispiel:
```bash
-$ npm install express --save
+$ npm install express
```
Wenn Sie Express vorübergehend installieren und nicht zur Abhängigkeitsliste hinzufügen wollen, geben Sie die Option `--save` nicht an:
```bash
-$ npm install express
+$ npm install express --no-save
```
Node-Module, die mit der Option `--save` installiert werden, werden zur `Abhängigkeitsliste` in der Datei `package.json` hinzugefügt. Danach werden bei der Ausführung von `npm install` im Verzeichnis `app` automatisch alle Module in der Abhängigkeitsliste installiert.
+
+### [Next: Hello World ](/{{ page.lang }}/starter/hello-world.html)
\ No newline at end of file
diff --git a/de/starter/static-files.md b/de/starter/static-files.md
old mode 100755
new mode 100644
index c9c674bf32..cfc96142f2
--- a/de/starter/static-files.md
+++ b/de/starter/static-files.md
@@ -4,13 +4,23 @@ title: Statische Dateien in Express bereitstellen
description: Understand how to serve static files like images, CSS, and JavaScript in Express.js applications using the built-in 'static' middleware.
menu: starter
lang: de
+redirect_from: " "
---
# Statische Dateien in Express bereitstellen
Wenn Sie statische Dateien wie Bilder, CSS-Dateien und JavaScript-Dateien bereitstellen wollen, verwenden Sie die in Express integrierte Middlewarefunktion `express.static`.
-Übergeben Sie den Namen des Verzeichnisses mit den statischen Assets an die Middlewarefunktion `express.static`, um direkt mit dem Bereitstellen der Dateien zu beginnen. Beispiel: Verwenden Sie den folgenden Code, um Bilder, CSS-Dateien und JavaScript-Dateien in einem Verzeichnis namens `public` bereitzustellen:
+The function signature is:
+
+```js
+express.static(root, [options])
+```
+
+The `root` argument specifies the root directory from which to serve static assets.
+For more information on the `options` argument, see [express.static](/{{page.lang}}/4x/api.html#express.static).
+
+Beispiel: Verwenden Sie den folgenden Code, um Bilder, CSS-Dateien und JavaScript-Dateien in einem Verzeichnis namens `public` bereitzustellen:
```js
app.use(express.static('public'))
@@ -26,8 +36,7 @@ http://localhost:3000/images/bg.png
http://localhost:3000/hello.html
```
-
-Express sucht nach den Dateien, die sich auf das Verzeichnis mit den statischen Assets beziehen. Der Name dieses Verzeichnisses ist also nicht Teil der URL.
+Express sucht nach den Dateien, die sich auf das Verzeichnis mit den statischen Assets beziehen. Der Name dieses Verzeichnisses ist also nicht Teil der URL.
Wenn Sie mehrere Verzeichnisse mit statischen Assets verwenden wollen, rufen Sie die Middlewarefunktion `express.static` mehrmals auf:
@@ -38,6 +47,11 @@ app.use(express.static('files'))
Express sucht in der Reihenfolge nach den Dateien, in der sie die Verzeichnisse mit den statischen Assets über die Middlewarefunktion `express.static` festgelegt haben.
+{% capture alert_content %}
+For best results, [use a reverse proxy](/{{page.lang}}/advanced/best-practice-performance.html#use-a-reverse-proxy) cache to improve performance of serving static assets.
+{% endcapture %}
+{% include admonitions/note.html content=alert_content %}
+
Wenn Sie ein Präfix für einen virtuellen Pfad (in dem der Pfad nicht wirklich im Dateisystem existiert) für Dateien festlegen wollen, die über die Funktion `express.static` bereitgestellt werden, [müssen Sie einen Mountpfad](/{{ page.lang }}/4x/api.html#app.use) für das Verzeichnis mit den statischen Assets wie unten gezeigt angeben:
```js
@@ -60,3 +74,7 @@ Der Pfad, den Sie für die Funktion `express.static` angeben, ist jedoch relativ
const path = require('path')
app.use('/static', express.static(path.join(__dirname, 'public')))
```
+
+For more details about the `serve-static` function and its options, see [serve-static](/resources/middleware/serve-static.html).
+
+### [Previous: Basic Routing ](/{{ page.lang }}/starter/basic-routing.html) [Next: More examples ](/{{ page.lang }}/starter/examples.html)
diff --git a/de/support/index.md b/de/support/index.md
index 1f1c15b326..3b8f83c223 100644
--- a/de/support/index.md
+++ b/de/support/index.md
@@ -1,6 +1,7 @@
---
layout: page
title: Version Support
+description: Find information about the support schedule for different Express.js versions, including which versions are currently maintained and end-of-life policies.
menu: support
lang: de
---
@@ -11,17 +12,17 @@ Only the latest version of any given major release line is supported.
Versions that are EOL (end-of-life) _may_ receive updates for critical security vulnerabilities, but the Express team offers no guarantee and does not plan to address or release fixes for any issues found.
-| Major Version | Minimum Node.js Version | Support Start Date | Support End Date |
-| -- | -- | -- | -- |
-| [**v5.x**{: .supported }](/{{page.lang}}/5x/api.html){: .ignore-underline} | 18 | September 2024 | **ongoing**{: .supported } |
-| [**v4.x**{: .supported }](/{{page.lang}}/4x/api.html){: .ignore-underline} | 0.10.0 | April 2014 | **ongoing**{: .supported } |
-| [**v3.x**{: .eol }](/{{page.lang}}/3x/api.html){: .ignore-underline} | 0.8.0 | October 2012 | July 2015 |
-| [**v2.x**{: .eol }](/2x/){: .ignore-underline} | 0.4.1 | March 2011 | July 2012 |
-| **v1.x**{: .eol } | 0.2.0 | December 2010 | March 2011 |
-| **v0.14.x**{: .eol } | 0.1.98 | December 2010 | December 2010 |
+| Major Version | Minimum Node.js Version | Support Start Date | Support End Date |
+| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | ------------------ | ---------------------------------------------------------- |
+| [**v5.x**{: .supported }](/{{page.lang}}/5x/api.html){: .ignore-underline} | 18 | September 2024 | **ongoing**{: .supported } |
+| [**v4.x**{: .supported }](/{{page.lang}}/4x/api.html){: .ignore-underline} | 0.10.0 | April 2014 | **ongoing**{: .supported } |
+| [**v3.x**{: .eol }](/{{page.lang}}/3x/api.html){: .ignore-underline} | 0.8.0 | October 2012 | July 2015 |
+| [**v2.x**{: .eol }](/2x/){: .ignore-underline} | 0.4.1 | March 2011 | July 2012 |
+| **v1.x**{: .eol } | 0.2.0 | December 2010 | March 2011 |
+| **v0.14.x**{: .eol } | 0.1.98 | December 2010 | December 2010 |
## Commercial Support Options
If you are unable to update to a supported version of Express, please contact one of our partners to receive security updates:
- - [HeroDevs Never-Ending Support](http://www.herodevs.com/support/express-nes?utm_source=expressjs&utm_medium=link&utm_campaign=express_eol_page)
+- [HeroDevs Never-Ending Support](http://www.herodevs.com/support/express-nes?utm_source=expressjs&utm_medium=link&utm_campaign=express_eol_page)
diff --git a/es/3x/api.md b/es/3x/api.md
old mode 100755
new mode 100644
index 2f66699741..4a4087260f
--- a/es/3x/api.md
+++ b/es/3x/api.md
@@ -2,34 +2,25 @@
layout: api
version: 3x
title: Express 3.x - Referencia de API
-lang: es
-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: 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.
+lang: en
+redirect_from: " "
---
+
**Express 3.x YA NO SE MANTIENE**
- Los problemas de rendimiento y seguridad conocidos y desconocidos en 3.x no se han solucionado desde la última actualización (1 de agosto de 2015). Se recomienda especialmente utilizar la última versión de Express.
-
-
- API de 3.x+Los problemas de rendimiento y seguridad conocidos y desconocidos en 3.x no se han solucionado desde la última actualización (1 de agosto de 2015). Se recomienda especialmente utilizar la última versión de Express. - - {% include api/en/3x/express.md %} +If you are unable to upgrade past 3.x, please consider [Commercial Support Options](/{{ page.lang }}/support#commercial-support-options). - - {% include api/en/3x/app.md %} - - - {% include api/en/3x/req.md %} +API de 3.x- - {% include api/en/3x/middleware.md %} + +{% include api/en/3x/app.md %}API de 4.x- - {% include api/en/4x/express.md %} +{% capture node-version %} - - {% include api/en/4x/app.md %} +``` +Express 4.0 requires Node.js 0.10 or higher. +``` - - {% include api/en/4x/req.md %} +{% endcapture %} - - {% include api/en/4x/res.md %} +{% include admonitions/note.html content=node-version %} - - {% include api/en/4x/router.md %} + +{% include api/en/4x/app.md %}5.x API-{% include admonitions/caution.html content="This is early beta documentation that may be incomplete and is still under development." %} +{% capture node-version %} -{% include admonitions/note.html content="Express 5.0 requires Node.js 18 or higher." %} +``` +Express 5.0 requires Node.js 18 or higher. +``` + +{% endcapture %} + +{% include admonitions/note.html content=node-version %} {% include api/en/5x/express.md %} {% include api/en/5x/app.md %} diff --git a/es/advanced/best-practice-performance.md b/es/advanced/best-practice-performance.md old mode 100755 new mode 100644 index cfeba1a566..227feddb69 --- a/es/advanced/best-practice-performance.md +++ b/es/advanced/best-practice-performance.md @@ -1,53 +1,49 @@ --- layout: page title: Mejores prácticas de rendimiento cuando se utiliza Express en producción +description: Discover performance and reliability best practices for Express apps in production, covering code optimizations and environment setups for optimal performance. menu: advanced -lang: es -description: Discover performance and reliability best practices for Express apps - in production, covering code optimizations and environment setups for optimal performance. +lang: en +redirect_from: " " --- -# Mejores prácticas de producción: rendimiento y fiabilidad - -## Visión general +# Production best practices: performance and reliability En este artículo se describen las mejores prácticas de rendimiento y fiabilidad para las aplicaciones Express desplegadas en producción. Este tema entra claramente dentro del área de "DevOps", que abarca operaciones y desarrollos tradicionales. Por lo tanto, la información se divide en dos partes: -- Cosas que hacer en el código (la parte de desarrollo): - - [Utilizar la compresión de gzip](#utilizar-la-compresión-de-gzip) - - [No utilizar funciones síncronas](#no-utilizar-funciones-síncronas) - - [Realizar un registro correcto](#realizar-un-registro-correcto) - - [Manejar las excepciones correctamente](#manejar-las-excepciones-correctamente) -- Cosas que hacer en el entorno / configuración (la parte de operaciones): - - - [Establecer NODE_ENV en "production"](#establecer-node_env-en-production) - - [Asegurarse de que la aplicación se reinicia automáticamente](#asegurarse-de-que-la-aplicación-se-reinicia-automáticamente) - - [Ejecutar la aplicación en un clúster](#ejecutar-la-aplicación-en-un-clúster) - - [Almacenar en la caché los resultados de la solicitud](#almacenar-en-la-caché-los-resultados-de-la-solicitud) - - [Utilizar un equilibrador de carga](#utilizar-un-equilibrador-de-carga) - - [Utilizar un proxy inverso](#utilizar-un-proxy-inverso) - - +- Cosas que hacer en el código (la parte de desarrollo): + - [Utilizar la compresión de gzip](#utilizar-la-compresión-de-gzip) + - [No utilizar funciones síncronas](#no-utilizar-funciones-síncronas) + - [Realizar un registro correcto](#realizar-un-registro-correcto) + - [Manejar las excepciones correctamente](#manejar-las-excepciones-correctamente) +- Cosas que hacer en el entorno / configuración (la parte de operaciones): + - [Establecer NODE_ENV en "production"](#establecer-node_env-en-production) + - [Asegurarse de que la aplicación se reinicia automáticamente](#asegurarse-de-que-la-aplicación-se-reinicia-automáticamente) + - [Ejecutar la aplicación en un clúster](#ejecutar-la-aplicación-en-un-clúster) + - [Almacenar en la caché los resultados de la solicitud](#almacenar-en-la-caché-los-resultados-de-la-solicitud) + - [Utilizar un equilibrador de carga](#utilizar-un-equilibrador-de-carga) + - [Utilizar un proxy inverso](#utilizar-un-proxy-inverso) ## Cosas que hacer en el código Estas son algunas de las cosas que puede hacer en el código para mejorar el rendimiento de la aplicación: -- [Utilizar la compresión de gzip](#utilizar-la-compresión-de-gzip) -- [No utilizar funciones síncronas](#no-utilizar-funciones-síncronas) -- [Realizar un registro correcto](#realizar-un-registro-correcto) -- [Manejar las excepciones correctamente](#manejar-las-excepciones-correctamente) +- [Utilizar la compresión de gzip](#utilizar-la-compresión-de-gzip) +- [No utilizar funciones síncronas](#no-utilizar-funciones-síncronas) +- [Realizar un registro correcto](#realizar-un-registro-correcto) +- [Manejar las excepciones correctamente](#manejar-las-excepciones-correctamente) ### Utilizar la compresión de gzip -La compresión de gzip puede disminuir significativamente el tamaño del cuerpo de respuesta y, por lo tanto, aumentar la velocidad de una aplicación web. Utilice el middleware de [compresión](https://www.npmjs.com/package/compression) para la compresión de gzip en la aplicación Express. Por ejemplo: +La compresión de gzip puede disminuir significativamente el tamaño del cuerpo de respuesta y, por lo tanto, aumentar la velocidad de una aplicación web. Utilice el middleware de [compresión](https://www.npmjs.com/package/compression) para la compresión de gzip en la aplicación Express. For example: ```js const compression = require('compression') const express = require('express') const app = express() + app.use(compression()) ``` @@ -59,21 +55,19 @@ Las funciones síncronas y los métodos impiden el avance del proceso de ejecuci Aunque Node y muchos módulos proporcionan versiones síncronas y asíncronas de las funciones, utilice siempre la versión asíncrona en producción. La única vez que está justificado utilizar una función síncrona es en el arranque inicial. -Si utiliza Node.js 4.0+ o io.js 2.1.0+, puede utilizar el distintivo de línea de mandatos `--trace-sync-io` para imprimir un aviso y un seguimiento de la pila siempre que la aplicación utilice una API síncrona. Desde luego, no deseará utilizarlo en producción, sólo para garantizar que el código está listo para producción. Consulte [Weekly update for io.js 2.1.0](https://nodejs.org/en/blog/weekly-updates/weekly-update.2015-05-22/#2-1-0) para obtener más información. +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. Desde luego, no deseará utilizarlo en producción, sólo para garantizar que el código está listo para producción. Consulte [Weekly update for io.js 2.1.0](https://nodejs.org/en/blog/weekly-updates/weekly-update.2015-05-22/#2-1-0) para obtener más información. ### Realizar un registro correcto -En general, hay dos motivos para realizar un registro desde la aplicación: a efectos de depuración o para registrar la actividad de la aplicación (básicamente, todo lo demás). El uso de `console.log()` o `console.err()` para imprimir mensajes de registro en el terminal es una práctica común en el desarrollo. No obstante, [estas funciones son síncronas](https://nodejs.org/api/console.html#console_console_1) cuando el destino es un terminal o un archivo, por lo que no son adecuadas para producción, a menos que canalice la salida a otro programa. +En general, hay dos motivos para realizar un registro desde la aplicación: a efectos de depuración o para registrar la actividad de la aplicación (básicamente, todo lo demás). El uso de `console.log()` o `console.err()` para imprimir mensajes de registro en el terminal es una práctica común en el desarrollo. 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. -#### A efectos de depuración +#### For debugging Si realiza el registro a efectos de depuración, en lugar de utilizar `console.log()`, utilice un módulo de depuración especial como [debug](https://www.npmjs.com/package/debug). Este módulo permite utilizar la variable de entorno DEBUG para controlar qué mensajes de depuración se envían a `console.err()`, si se envía alguno. Para mantener la aplicación básicamente asíncrona, deberá canalizar `console.err()` a otro programa. Pero en este caso, realmente no va a depurar en producción, ¿no? #### Para la actividad de la aplicación -Si está registrando la actividad de la aplicación (por ejemplo, realizando un seguimiento del tráfico o las llamadas de API), en lugar de utilizar `console.log()`, utilice una biblioteca de registro como [Winston](https://www.npmjs.com/package/winston) o [Bunyan](https://www.npmjs.com/package/bunyan). Para ver una comparación detallada de estas dos bibliotecas, consulte el post del blog StrongLoop [Comparing Winston and Bunyan Node.js Logging](https://web.archive.org/web/20240000000000/https://strongloop.com/strongblog/compare-node-js-logging-winston-bunyan/). - - +If you're logging app activity (for example, tracking traffic or API calls), instead of using `console.log()`, use a logging library like [Pino](https://www.npmjs.com/package/pino), which is the fastest and most efficient option available. ### Manejar las excepciones correctamente @@ -81,32 +75,19 @@ Las aplicaciones Node se bloquean cuando encuentran una excepción no capturada. Para asegurarse de manejar todas las excepciones, siga estas técnicas: -- [Utilizar try-catch](#try-catch) -- [Utilizar promesas](#utilizar-promesas) +- [Utilizar try-catch](#try-catch) +- [Utilizar promesas](#utilizar-promesas) Antes de profundizar en estos temas, deberá tener unos conocimientos básicos del manejo de errores de Node/Express: el uso de devoluciones de llamada error-first y la propagación de errores en el middleware. Node utiliza un convenio de "devolución de llamada error-first" para devolver los errores de las funciones asíncronas, donde el primer parámetro en la función de devolución de llamada es el objeto de error, seguido de los datos de resultados en los parámetros posteriores. Para indicar que no hay ningún error, pase null como el primer parámetro. La función de devolución de llamada debe seguir por lo tanto el convenio de devolución de llamada error-first para manejar correctamente el error. En Express, la práctica recomendada es utilizar la función next() para propagar los errores a través de la cadena de middleware. Para obtener más información sobre los aspectos básicos del manejo de errores, consulte: -- [Error Handling in Node.js](https://www.tritondatacenter.com/node-js/production/design/errors) -- [Building Robust Node Applications: Error Handling](https://web.archive.org/web/20240000000000/https://strongloop.com/strongblog/robust-node-applications-error-handling/) (blog StrongLoop) - -#### Qué no debe hacer - -Algo que _no_ debe hacer es escuchar el suceso `uncaughtException`, que se emite cuando una excepción se reproduce hacia atrás en el bucle de sucesos. La adición de un escucha de sucesos para `uncaughtException` cambiará el comportamiento predeterminado del proceso que se encuentra con la excepción; el proceso continuará ejecutándose a pesar de la excepción. Esto puede parecer una buena forma de evitar el bloqueo de la aplicación, pero continuar ejecutando la aplicación después de una excepción no capturada es una práctica peligrosa y no se recomienda, ya que el estado del proceso se vuelve imprevisible y poco fiable. - -Asimismo, el uso de `uncaughtException` se reconoce oficialmente como un mecanismo [arduo](https://nodejs.org/api/process.html#process_event_uncaughtexception) y hay una [propuesta](https://github.com/nodejs/node-v0.x-archive/issues/2582) para eliminarlo del núcleo. Por lo tanto, la escucha `uncaughtException` no es una buena idea. Es por esto por lo que se recomiendan varios procesos y supervisores; el bloqueo y el reinicio es a menudo la forma más fiable de recuperarse de un error. - -Tampoco se recomienda el uso de [dominios](https://nodejs.org/api/domain.html). Generalmente no soluciona el problema y es un módulo en desuso. - - +- [Error Handling in Node.js](https://www.tritondatacenter.com/node-js/production/design/errors) #### Utilizar try-catch Try-catch es una construcción de lenguaje JavaScript que puede utilizar para capturar excepciones en código síncrono. Por ejemplo, utilice try-catch para manejar los errores de análisis de JSON, como se muestra a continuación. -Utilice una herramienta como [JSHint](http://jshint.com/) o [JSLint](http://www.jslint.com/) para buscar excepciones implícitas como [errores de referencia o variables sin definir](http://www.jshint.com/docs/options/#undef). - A continuación, se muestra un ejemplo de uso de try-catch para manejar una posible excepción de bloqueo de proceso. Esta función de middleware acepta un parámetro de campo de consulta denominado "params" que es un objeto JSON. @@ -127,100 +108,86 @@ app.get('/search', (req, res) => { No obstante, try-catch sólo funciona para el código síncrono. Como la plataforma de Node es principalmente asíncrona (particularmente en un entorno de producción), try-catch no capturará muchas excepciones. - +#### Use promises -#### Utilizar promesas - -Las promesas manejarán todas las excepciones (explícitas e implícitas) en los bloques de códigos asíncronos que utilicen `then()`. Sólo tiene que añadir `.catch(next)` al final de las cadenas de promesas. Por ejemplo: +When an error is thrown in an `async` function or a rejected promise is awaited inside an `async` function, those errors will be passed to the error handler as if calling `next(err)` ```js -app.get('/', (req, res, next) => { - // do some sync stuff - queryDb() - .then((data) => makeCsv(data)) // handle data - .then((csv) => { /* handle csv */ }) - .catch(next) +app.get('/', async (req, res, next) => { + const data = await userData() // If this promise fails, it will automatically call `next(err)` to handle the error. + + res.send(data) }) app.use((err, req, res, next) => { - // handle error + res.status(err.status ?? 500).send({ error: err.message }) }) ``` -Ahora todos los errores, asíncronos y síncronos, se propagarán al middleware de errores. - -No obstante, hay dos advertencias: - -1. Todo el código asíncrono debe devolver promesas (excepto los emisores). Si una determinada biblioteca no devuelve promesas, convierta el objeto base utilizando una función de ayuda como [Bluebird.promisifyAll()](http://bluebirdjs.com/docs/api/promise.promisifyall.html). -2. Los emisores de sucesos (como las secuencias) todavía pueden provocar excepciones no capturadas. Por lo tanto, asegúrese de que está manejando el suceso de error correctamente; por ejemplo: +Also, you can use asynchronous functions for your middleware, and the router will handle errors if the promise fails, for example: ```js -const wrap = fn => (...args) => fn(...args).catch(args[2]) +app.use(async (req, res, next) => { + req.locals.user = await getUser(req) -app.get('/', wrap(async (req, res, next) => { - const company = await getCompanyById(req.query.id) - const stream = getLogoStreamById(company.id) - stream.on('error', next).pipe(res) -})) + next() // This will be called if the promise does not throw an error. +}) ``` -La función `wrap()` es un envoltorio que toma las promesas rechazadas y llama a `next()` con el error como primer argumento. Para más detalles, vea [Asynchronous Error Handling in Express with Promises, Generators and ES7](https://web.archive.org/web/20240000000000/https://strongloop.com/strongblog/async-error-handling-expressjs-es7-promises-generators/). +Best practice is to handle errors as close to the site as possible. So while this is now handled in the router, it’s best to catch the error in the middleware and handle it without relying on separate error-handling middleware. -Para más información acerca del manejo de errores utilizando promesas, vea [Promises in Node.js with Q – An Alternative to Callbacks](https://web.archive.org/web/20240000000000/https://strongloop.com/strongblog/promises-in-node-js-with-q-an-alternative-to-callbacks/). +#### Qué no debe hacer -## Cosas que hacer en el entorno / configuración +Algo que _no_ debe hacer es escuchar el suceso `uncaughtException`, que se emite cuando una excepción se reproduce hacia atrás en el bucle de sucesos. La adición de un escucha de sucesos para `uncaughtException` cambiará el comportamiento predeterminado del proceso que se encuentra con la excepción; el proceso continuará ejecutándose a pesar de la excepción. Esto puede parecer una buena forma de evitar el bloqueo de la aplicación, pero continuar ejecutando la aplicación después de una excepción no capturada es una práctica peligrosa y no se recomienda, ya que el estado del proceso se vuelve imprevisible y poco fiable. -Estas son algunas de las cosas que puede hacer en el entorno del sistema para mejorar el rendimiento de la aplicación: +Asimismo, el uso de `uncaughtException` se reconoce oficialmente como un mecanismo [arduo](https://nodejs.org/api/process.html#process_event_uncaughtexception) y hay una [propuesta](https://github.com/nodejs/node-v0.x-archive/issues/2582) para eliminarlo del núcleo. Por lo tanto, la escucha `uncaughtException` no es una buena idea. Es por esto por lo que se recomiendan varios procesos y supervisores; el bloqueo y el reinicio es a menudo la forma más fiable de recuperarse de un error. -- [Establecer NODE_ENV en "production"](#establecer-node_env-en-production) -- [Asegurarse de que la aplicación se reinicia automáticamente](#asegurarse-de-que-la-aplicación-se-reinicia-automáticamente) -- [Ejecutar la aplicación en un clúster](#ejecutar-la-aplicación-en-un-clúster) -- [Almacenar en la caché los resultados de la solicitud](#almacenar-en-la-caché-los-resultados-de-la-solicitud) -- [Utilizar un equilibrador de carga](#utilizar-un-equilibrador-de-carga) -- [Utilizar un proxy inverso](#utilizar-un-proxy-inverso) +Tampoco se recomienda el uso de [dominios](https://nodejs.org/api/domain.html). Generalmente no soluciona el problema y es un módulo en desuso. -### Establecer NODE_ENV en "production" +## Things to do in your environment / setup -La variable de entorno NODE_ENV especifica el entorno en el que se ejecuta una aplicación (normalmente, desarrollo o producción). Una de las cosas más sencillas que puede hacer para mejorar el rendimiento es establecer NODE_ENV en "production". +{#in-environment} -Si establece NODE_ENV en "production", Express: +Estas son algunas de las cosas que puede hacer en el entorno del sistema para mejorar el rendimiento de la aplicación: -- Almacena en la caché las plantillas de vistas. -- Almacena en la caché los archivos CSS generados en las extensiones CSS. -- Genera menos mensajes de error detallados. +- [Establecer NODE_ENV en "production"](#establecer-node_env-en-production) +- [Asegurarse de que la aplicación se reinicia automáticamente](#asegurarse-de-que-la-aplicación-se-reinicia-automáticamente) +- [Ejecutar la aplicación en un clúster](#ejecutar-la-aplicación-en-un-clúster) +- [Almacenar en la caché los resultados de la solicitud](#almacenar-en-la-caché-los-resultados-de-la-solicitud) +- [Utilizar un equilibrador de carga](#utilizar-un-equilibrador-de-carga) +- [Utilizar un proxy inverso](#utilizar-un-proxy-inverso) -Las [pruebas indican](http://apmblog.dynatrace.com/2015/07/22/the-drastic-effects-of-omitting-node_env-in-your-express-js-applications/) que sólo esta acción puede mejorar hasta tres veces el rendimiento de la aplicación. +### Establecer NODE_ENV en "production" -Si necesita escribir código específico del entorno, puede comprobar el valor de NODE_ENV con `process.env.NODE_ENV`. Tenga en cuenta que comprobar el valor de una variable de entorno supone una reducción de rendimiento, por lo que debe hacerse moderadamente. +La variable de entorno NODE_ENV especifica el entorno en el que se ejecuta una aplicación (normalmente, desarrollo o producción). One of the simplest things you can do to improve performance is to set NODE_ENV to `production`. -En el desarrollo, normalmente establece las variables de entorno en el shell interactivo, por ejemplo, utilizando `export` o su archivo `.bash_profile`. Sin embargo, en general, no debe hacerlo en un servidor de producción; en su lugar, utilice el sistema init de su sistema operativo (systemd o Upstart). En la siguiente sección se proporcionan más detalles sobre el uso del sistema init en general, pero el establecimiento de NODE_ENV es tan importante (y fácil de hacer) para el rendimiento, que se resalta aquí. +Si establece NODE_ENV en "production", Express: -Con Upstart, utilice la palabra clave `env` en el archivo de trabajo. Por ejemplo: +- Almacena en la caché las plantillas de vistas. +- Almacena en la caché los archivos CSS generados en las extensiones CSS. +- Genera menos mensajes de error detallados. -```sh -# /etc/init/env.conf - env NODE_ENV=production -``` +[Tests indicate](https://www.dynatrace.com/news/blog/the-drastic-effects-of-omitting-node-env-in-your-express-js-applications/) that just doing this can improve app performance by a factor of three! -Para obtener más información, consulte [Upstart Intro, Cookbook and Best Practices](http://upstart.ubuntu.com/cookbook/#environment-variables). +If you need to write environment-specific code, you can check the value of NODE_ENV with `process.env.NODE_ENV`. Tenga en cuenta que comprobar el valor de una variable de entorno supone una reducción de rendimiento, por lo que debe hacerse moderadamente. -Con systemd, utilice la directiva `Environment` en el archivo unit. Por ejemplo: +En el desarrollo, normalmente establece las variables de entorno en el shell interactivo, por ejemplo, utilizando `export` o su archivo `.bash_profile`. But in general, you shouldn't do that on a production server; instead, use your OS's init system (systemd). En la siguiente sección se proporcionan más detalles sobre el uso del sistema init en general, pero el establecimiento de NODE_ENV es tan importante (y fácil de hacer) para el rendimiento, que se resalta aquí. + +Con systemd, utilice la directiva `Environment` en el archivo unit. For example: ```sh # /etc/systemd/system/myservice.service Environment=NODE_ENV=production ``` -Para obtener más información, consulte [Using Environment Variables In systemd Units](https://coreos.com/os/docs/latest/using-environment-variables-in-systemd-units.html). - -Si está utilizando StrongLoop Process Manager, también puede [establecer la variable de entorno cuando instala StrongLoop PM como un servicio](https://docs.strongloop.com/display/SLC/Setting+up+a+production+host#Settingupaproductionhost-Setenvironmentvariables). +For more information, see [Using Environment Variables In systemd Units](https://www.flatcar.org/docs/latest/setup/systemd/environment-variables/). ### Asegurarse de que la aplicación se reinicia automáticamente En la producción, no desea que la aplicación esté nunca fuera de línea. Esto significa que debe asegurarse de que se reinicia si la aplicación o el servidor se bloquean. Aunque espera que no se produzca ninguno de estos sucesos, si somos realistas, debe tener en cuenta ambas eventualidades de la siguiente manera: -- Utilizando un gestor de procesos para reiniciar la aplicación (y Node) cuando se bloquea. -- Utilizando el sistema init que proporciona su sistema operativo para reiniciar el gestor de procesos cuando se bloquea el sistema operativo. También puede utilizar el sistema init sin un gestor de procesos. +- Utilizando un gestor de procesos para reiniciar la aplicación (y Node) cuando se bloquea. +- Utilizando el sistema init que proporciona su sistema operativo para reiniciar el gestor de procesos cuando se bloquea el sistema operativo. También puede utilizar el sistema init sin un gestor de procesos. Las aplicaciones Node se bloquean si encuentran una excepción no capturada. Lo primero que debe hacer es asegurarse de que se realizan las pruebas correctas en la aplicación y que se manejan todas las excepciones (consulte [Manejar correctamente las excepciones](#exceptions) para obtener detalles). No obstante, para estar libre de errores, aplique un mecanismo para garantizar que cuando se bloquee la aplicación, se reinicie automáticamente. @@ -230,54 +197,35 @@ En el desarrollo, la aplicación se inicia simplemente desde la línea de mandat Además de reiniciar la aplicación cuando se bloquea, un gestor de procesos permite: -- Obtener información útil sobre el rendimiento en tiempo de ejecución y el consumo de recursos. -- Modificar dinámicamente los valores para mejorar el rendimiento. -- Controlar la agrupación en clúster (StrongLoop PM y pm2). +- Obtener información útil sobre el rendimiento en tiempo de ejecución y el consumo de recursos. +- Modificar dinámicamente los valores para mejorar el rendimiento. +- Control clustering (pm2). -Los gestores de procesos más conocidos para Node son los siguientes: - -- [StrongLoop Process Manager](http://strong-pm.io/) -- [PM2](https://github.com/Unitech/pm2) -- [Forever](https://www.npmjs.com/package/forever) - -Para ver una comparación característica a característica de los tres gestores de procesos, consulte [http://strong-pm.io/compare/](http://strong-pm.io/compare/). - -El uso de cualquiera de estos gestores de procesos bastará para mantener activa la aplicación, aunque se bloquee cada cierto tiempo. - -No obstante, StrongLoop PM tiene muchas características especialmente indicadas para el despliegue de producción. Puede utilizarlo y las herramientas relacionadas de StrongLoop para: - -- Crear y empaquetar la aplicación localmente y, a continuación, desplegarla de forma segura en el sistema de producción. -- Reiniciar automáticamente la aplicación si se bloque por cualquier motivo. -- Gestionar los clústeres de forma remota. -- Ver perfiles de CPU e instantáneas de almacenamiento dinámico para optimizar el rendimiento y diagnosticar fugas de memoria. -- Ver medidas de rendimiento para la aplicación. -- Escalar fácilmente a varios hosts con control integrado para el equilibrador de carga Nginx. - -Como se explica a continuación, cuando instala StrongLoop PM como un servicio de sistema operativo utilizando el sistema init, se reinicia automáticamente cuando se reinicia el sistema. De esta forma, mantiene activos siempre los clústeres y los procesos de aplicaciones. +Historically, it was popular to use a Node.js process manager like [PM2](https://github.com/Unitech/pm2). See their documentation if you wish to do this. However, we recommend using your init system for process management. #### Utilizar un sistema init -La siguiente capa de fiabilidad es garantizar que la aplicación se reinicie cuando se reinicie el servidor. Los sistemas pueden bloquearse por una amplia variedad de motivos. Para garantizar que la aplicación se reinicie si se bloquea el servidor, utilice el sistema init incorporado en su sistema operativo. Los dos principales sistemas init que se utilizan hoy día son [systemd](https://wiki.debian.org/systemd) y [Upstart](http://upstart.ubuntu.com/). +La siguiente capa de fiabilidad es garantizar que la aplicación se reinicie cuando se reinicie el servidor. Los sistemas pueden bloquearse por una amplia variedad de motivos. Para garantizar que la aplicación se reinicie si se bloquea el servidor, utilice el sistema init incorporado en su sistema operativo. The main init system in use today is [systemd](https://wiki.debian.org/systemd). Hay dos formas de utilizar los sistemas init con la aplicación Express: -- Ejecutar la aplicación en un gestor de procesos e instalar el gestor de procesos como un servicio con el sistema init. El gestor de procesos reiniciará la aplicación cuando esta se bloquee y el sistema init reiniciará el gestor de procesos cuando se reinicie el sistema operativo. Este es el enfoque recomendado. -- Ejecutar la aplicación (y Node) directamente con el sistema init. Esta opción parece más simple, pero no tiene las ventajas adicionales de utilizar el gestor de procesos. +- Ejecutar la aplicación en un gestor de procesos e instalar el gestor de procesos como un servicio con el sistema init. El gestor de procesos reiniciará la aplicación cuando esta se bloquee y el sistema init reiniciará el gestor de procesos cuando se reinicie el sistema operativo. This is the recommended approach. +- Ejecutar la aplicación (y Node) directamente con el sistema init. Esta opción parece más simple, pero no tiene las ventajas adicionales de utilizar el gestor de procesos. ##### Systemd Systemd es un administrador de servicios y sistemas Linux. La mayoría de las principales distribuciones Linux han adoptado systemd como su sistema init predeterminado. -Un archivo de configuración de servicio de systemd se denomina un _archivo unit_, con un nombre de archivo terminado en .service. A continuación, se muestra un archivo unit de ejemplo para gestionar directamente una aplicación Node (sustituya el texto en negrita por los valores de su sistema y su aplicación): +Un archivo de configuración de servicio de systemd se denomina un _archivo unit_, con un nombre de archivo terminado en .service. A continuación, se muestra un archivo unit de ejemplo para gestionar directamente una aplicación Node (sustituya el texto en negrita por los valores de su sistema y su aplicación): Replace the values enclosed in `${options.message}`) return callback(null, rendered) }) @@ -34,6 +35,7 @@ La aplicación ahora podrá representar archivos `.ntl`. Cree un archivo denomin #title# #message# ``` + A continuación, cree la ruta siguiente en la aplicación. ```js @@ -41,4 +43,5 @@ app.get('/', (req, res) => { res.render('index', { title: 'Hey', message: 'Hello there!' }) }) ``` -Cuando realice una solicitud a la página de inicio, `index.ntl` se representará como HTML. + +Cuando realice una solicitud a la página de inicio, `index.ntl` se representará como HTML. \ No newline at end of file diff --git a/es/advanced/healthcheck-graceful-shutdown.md b/es/advanced/healthcheck-graceful-shutdown.md new file mode 100644 index 0000000000..3e233fb436 --- /dev/null +++ b/es/advanced/healthcheck-graceful-shutdown.md @@ -0,0 +1,34 @@ +--- +layout: page +title: Health Checks and Graceful Shutdown +description: Learn how to implement health checks and graceful shutdown in Express apps to enhance reliability, manage deployments, and integrate with load balancers like Kubernetes. +menu: advanced +lang: en +redirect_from: " " +--- + +# Health Checks and Graceful Shutdown + +## Graceful shutdown + +When you deploy a new version of your application, you must replace the previous version. The process manager you're using will first send a SIGTERM signal to the application to notify it that it will be killed. Once the application gets this signal, it should stop accepting new requests, finish all the ongoing requests, clean up the resources it used, including database connections and file locks then exit. + +### + +```js +const server = app.listen(port) + +process.on('SIGTERM', () => { + debug('SIGTERM signal received: closing HTTP server') + server.close(() => { + debug('HTTP server closed') + }) +}) +``` + +## Health checks + +A load balancer uses health checks to determine if an application instance is healthy and can accept requests. For example, [Kubernetes has two health checks](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/): + +- `liveness`, that determines when to restart a container. +- `readiness`, that determines when a container is ready to start accepting traffic. When a pod is not ready, it is removed from the service load balancers. \ No newline at end of file diff --git a/es/advanced/security-updates.md b/es/advanced/security-updates.md old mode 100755 new mode 100644 index bcabee2cc6..bc60b5a245 --- a/es/advanced/security-updates.md +++ b/es/advanced/security-updates.md @@ -1,47 +1,88 @@ --- layout: page title: Actualizaciones de seguridad de Express +description: Review the latest security updates and patches for Express.js, including detailed vulnerability lists for different versions to help maintain a secure application. menu: advanced -lang: es -description: Review the latest security updates and patches for Express.js, including - detailed vulnerability lists for different versions to help maintain a secure application. +lang: en +redirect_from: " " --- # Actualizaciones de seguridad
-Las vulnerabilidades de Node.js afectan directamente a Express. Por lo tanto, [vigile las vulnerabilidades de Node.js](https://nodejs.org
+Node.js vulnerabilities directly affect Express. Por lo tanto, [vigile las vulnerabilidades de Node.js](https://nodejs.org
/en/blog/vulnerability/) y asegúrese de utilizar la versión estable más reciente de Node.js.
En la lista siguiente se muestran las vulnerabilidades de Express que se han solucionado en la actualización de versión especificada.
+{% capture security-policy %}
+If you believe you have discovered a security vulnerability in Express, please see
+[Security Policies and Procedures](/{{page.lang}}/resources/contributing.html#security-policies-and-procedures).
+{% endcapture %}
+
+{% include admonitions/note.html content=security-policy %}
+
## 4.x
- * 4.11.1
- * Se ha solucionado la vulnerabilidad de divulgación de vía de acceso raíz en `express.static`, `res.sendfile` y `res.sendFile`
- * 4.10.7
- * Se ha solucionado la vulnerabilidad de Open Redirect en `express.static` ([anuncio](https://npmjs.com/advisories/35), [CVE-2015-1164](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-1164)).
- * 4.8.8
- * Se han solucionado las vulnerabilidades de cruce de directorios en `express.static` ([anuncio](http://npmjs.com/advisories/32) , [CVE-2014-6394](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-6394)).
- * 4.8.4
- * Node.js 0.10 puede tener fugas de `fd` en determinadas situaciones que afectan a `express.static` y `res.sendfile`. Las solicitudes maliciosas pueden provocar la fuga de `fd` y, en última instancia, generar errores `EMFILE` y anular la capacidad de respuesta del servidor.
- * 4.8.0
- * Las matrices dispersas que tienen índices extremadamente altos en la serie de consulta pueden hacer que el proceso se quede sin memoria y se bloquee el servidor.
- * Los objetos de serie de consulta extremadamente anidados pueden hacer que se bloquee el proceso y anular la capacidad de respuesta del servidor temporalmente.
+- 4.21.2
+ - The dependency `path-to-regexp` has been updated to address a [vulnerability](https://github.com/pillarjs/path-to-regexp/security/advisories/GHSA-rhx6-c78j-4q9w).
+- 4.21.1
+ - The dependency `cookie` has been updated to address a [vulnerability](https://github.com/jshttp/cookie/security/advisories/GHSA-pxg6-pf52-xh8x), This may affect your application if you use `res.cookie`.
+- 4.20.0
+ - Fixed XSS vulnerability in `res.redirect` ([advisory](https://github.com/expressjs/express/security/advisories/GHSA-qw6h-vgh9-j6wx), [CVE-2024-43796](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-43796)).
+ - The dependency `serve-static` has been updated to address a [vulnerability](https://github.com/advisories/GHSA-cm22-4g7w-348p).
+ - The dependency `send` has been updated to address a [vulnerability](https://github.com/advisories/GHSA-m6fv-jmcg-4jfg).
+ - The dependency `path-to-regexp` has been updated to address a [vulnerability](https://github.com/pillarjs/path-to-regexp/security/advisories/GHSA-9wv6-86v2-598j).
+ - The dependency `body-parser` has been updated to addres a [vulnerability](https://github.com/advisories/GHSA-qwcr-r2fm-qrc7), This may affect your application if you had url enconding activated.
+- 4.19.0, 4.19.1
+ - Fixed open redirect vulnerability in `res.location` and `res.redirect` ([advisory](https://github.com/expressjs/express/security/advisories/GHSA-rv95-896h-c2vc), [CVE-2024-29041](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-29041)).
+- 4.17.3
+ - The dependency `qs` has been updated to address a [vulnerability](https://github.com/advisories/GHSA-hrpp-h998-j3pp). This may affect your application if the following APIs are used: `req.query`, `req.body`, `req.param`.
+- 4.16.0
+ - The dependency `forwarded` has been updated to address a [vulnerability](https://npmjs.com/advisories/527). This may affect your application if the following APIs are used: `req.host`, `req.hostname`, `req.ip`, `req.ips`, `req.protocol`.
+ - The dependency `mime` has been updated to address a [vulnerability](https://npmjs.com/advisories/535), but this issue does not impact Express.
+ - The dependency `send` has been updated to provide a protection against a [Node.js 8.5.0 vulnerability](https://nodejs.org/en/blog/vulnerability/september-2017-path-validation/). This only impacts running Express on the specific Node.js version 8.5.0.
+- 4.15.5
+ - The dependency `debug` has been updated to address a [vulnerability](https://snyk.io/vuln/npm:debug:20170905), but this issue does not impact Express.
+ - The dependency `fresh` has been updated to address a [vulnerability](https://npmjs.com/advisories/526). This will affect your application if the following APIs are used: `express.static`, `req.fresh`, `res.json`, `res.jsonp`, `res.send`, `res.sendfile` `res.sendFile`, `res.sendStatus`.
+- 4.15.3
+ - The dependency `ms` has been updated to address a [vulnerability](https://snyk.io/vuln/npm:ms:20170412). This may affect your application if untrusted string input is passed to the `maxAge` option in the following APIs: `express.static`, `res.sendfile`, and `res.sendFile`.
+- 4.15.2
+ - The dependency `qs` has been updated to address a [vulnerability](https://snyk.io/vuln/npm:qs:20170213), but this issue does not impact Express. Updating to 4.15.2 is a good practice, but not required to address the vulnerability.
+- 4.11.1
+ - Se ha solucionado la vulnerabilidad de divulgación de vía de acceso raíz en `express.static`, `res.sendfile` y `res.sendFile`
+- 4.10.7
+ - Se ha solucionado la vulnerabilidad de Open Redirect en `express.static` ([anuncio](https://npmjs.com/advisories/35), [CVE-2015-1164](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-1164)).
+- 4.8.8
+ - Se han solucionado las vulnerabilidades de cruce de directorios en `express.static` ([anuncio](http://npmjs.com/advisories/32) , [CVE-2014-6394](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-6394)).
+- 4.8.4
+ - Node.js 0.10 puede tener fugas de `fd` en determinadas situaciones que afectan a `express.static` y `res.sendfile`. Las solicitudes maliciosas pueden provocar la fuga de `fd` y, en última instancia, generar errores `EMFILE` y anular la capacidad de respuesta del servidor.
+- 4.8.0
+ - Las matrices dispersas que tienen índices extremadamente altos en la serie de consulta pueden hacer que el proceso se quede sin memoria y se bloquee el servidor.
+ - Los objetos de serie de consulta extremadamente anidados pueden hacer que se bloquee el proceso y anular la capacidad de respuesta del servidor temporalmente.
## 3.x
- * 3.19.1
- * Se ha solucionado la vulnerabilidad de divulgación de vía de acceso raíz en `express.static`, `res.sendfile` y `res.sendFile`
- * 3.19.0
- * Se ha solucionado la vulnerabilidad de Open Redirect en `express.static` ([anuncio](https://npmjs.com/advisories/35), [CVE-2015-1164](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-1164)).
- * 3.16.10
- * Se han solucionado las vulnerabilidades de cruce de directorios en `express.static`.
- * 3.16.6
- * Node.js 0.10 puede tener fugas de `fd` en determinadas situaciones que afectan a `express.static` y `res.sendfile`. Las solicitudes maliciosas pueden provocar la fuga de `fd` y, en última instancia, generar errores `EMFILE` y anular la capacidad de respuesta del servidor.
- * 3.16.0
- * Las matrices dispersas que tienen índices extremadamente altos en la serie de consulta pueden hacer que el proceso se quede sin memoria y se bloquee el servidor.
- * Los objetos de serie de consulta extremadamente anidados pueden hacer que se bloquee el proceso y anular la capacidad de respuesta del servidor temporalmente.
- * 3.3.0
- * La respuesta 404 de un intento de alteración temporal de método no soportado era susceptible de ataques de scripts entre sitios.
+
+ **Express 3.x YA NO SE MANTIENE**
+
+Los problemas de rendimiento y seguridad conocidos y desconocidos en 3.x no se han solucionado desde la última actualización (1 de agosto de 2015). Se recomienda especialmente utilizar la última versión de Express.
+
+If you are unable to upgrade past 3.x, please consider [Commercial Support Options](/{{ page.lang }}/support#commercial-support-options).
+
+
+
+- 3.19.1
+ - Se ha solucionado la vulnerabilidad de divulgación de vía de acceso raíz en `express.static`, `res.sendfile` y `res.sendFile`
+- 3.19.0
+ - Se ha solucionado la vulnerabilidad de Open Redirect en `express.static` ([anuncio](https://npmjs.com/advisories/35), [CVE-2015-1164](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-1164)).
+- 3.16.10
+ - Se han solucionado las vulnerabilidades de cruce de directorios en `express.static`.
+- 3.16.6
+ - Node.js 0.10 puede tener fugas de `fd` en determinadas situaciones que afectan a `express.static` y `res.sendfile`. Las solicitudes maliciosas pueden provocar la fuga de `fd` y, en última instancia, generar errores `EMFILE` y anular la capacidad de respuesta del servidor.
+- 3.16.0
+ - Las matrices dispersas que tienen índices extremadamente altos en la serie de consulta pueden hacer que el proceso se quede sin memoria y se bloquee el servidor.
+ - Los objetos de serie de consulta extremadamente anidados pueden hacer que se bloquee el proceso y anular la capacidad de respuesta del servidor temporalmente.
+- 3.3.0
+ - La respuesta 404 de un intento de alteración temporal de método no soportado era susceptible de ataques de scripts entre sitios.
\ No newline at end of file
diff --git a/es/api.md b/es/api.md
old mode 100755
new mode 100644
index 639a07c26f..a34e0dcbc9
--- a/es/api.md
+++ b/es/api.md
@@ -1,28 +1,21 @@
---
layout: api
-version: 4x
-title: Express 4.x - Referencia de API
-lang: es
-description: Access the API reference for Express.js detailing all modules, methods,
- and properties for building web applications with this version.
+version: 5x
+title: Express 5.x - Referencia de API
+description: Access the API reference for Express.js detailing all modules, methods, and properties for building web applications with this version.
+lang: en
+redirect_from: " "
---
-
-
- API de 4.x- - - {% include api/en/4x/express.md %} +
+
diff --git a/id/changelog/index.md b/es/changelog/index.md
similarity index 80%
rename from id/changelog/index.md
rename to es/changelog/index.md
index d6f0bc121d..d64a7855b7 100644
--- a/id/changelog/index.md
+++ b/es/changelog/index.md
@@ -2,105 +2,171 @@
layout: page
title: Express changelog
description: Stay updated with the release changelog for Express.js, detailing new features, bug fixes, and important changes across versions.
-menu: changelog
-lang: id
-redirect_from:
- - "id/changelog/4x.html"
+lang: en
sitemap: false
+redirect_from:
+ - " "
+ - " "
---
+
+
+5.x API+ {% include api/en/5x/express.md %} - {% include api/en/4x/app.md %} - + {% include api/en/5x/app.md %} - {% include api/en/4x/req.md %} - + {% include api/en/5x/req.md %} - {% include api/en/4x/res.md %} - + {% include api/en/5x/res.md %} - {% include api/en/4x/router.md %} - + {% include api/en/5x/router.md %}
+
# Release changelog
All the latest updates, improvements, and fixes to Express
-## 5.0.1 - Release date: 2024-10-08
+## Express v5
+
+{: id="5.x"}
+
+### 5.1.0 - Release date: 2025-03-31
+
+{: id="5.0.1"}
+
+The 5.1.0 minor release includes some new features and improvements:
+
+- Support for sending responses as Uint8Array
+- Added support for ETag option in `res.sendFile()`
+- Added support for adding multiple links with the same rel with `res.links()`
+- Performance: Use loop for acceptParams
+- [body-parser@2.2.0](https://github.com/expressjs/body-parser/releases/tag/v2.2.0)
+ - Remove legacy node.js support checks for Brotli & `AsyncLocalStorage`
+ - Remove `unpipe` & `destroy`
+- [router@2.2.0](https://github.com/pillarjs/router/releases/tag/v2.2.0)
+ - Restore `debug`. Now with the `router` scope instead of `express`.
+ - Remove legacy node.js support checks for `setImmediate`
+ - Deprecate non-native promise support
+ - Remove `after`, `safe-buffer`, `array-flatten`, `setprotoypeof`, `methods`, `utils-merge`
+- [finalhandler@2.1.0](https://github.com/pillarjs/finalhandler/releases/tag/v2.1.0)
+ - Remove legacy node.js support checks for `headersSent`, `setImmediate`, & http2 support
+ - Remove `unpipe`
+- Transitioned all remaining dependencies to use `^` ranges instead of locked versions
+- Add package.json funding field to highlight our OpenCollective
+- See [Changelog v5.1.0](https://github.com/expressjs/express/releases/tag/v5.1.0)
+
+### 5.0.1 - Release date: 2024-10-08
+
{: id="5.0.1"}
The 5.0.1 patch release includes one security fix:
-* Update [jshttps/cookie](https://www.npmjs.com/package/cookie) to address a [vulnerability](https://github.com/advisories/GHSA-pxg6-pf52-xh8x).
+- Update [jshttps/cookie](https://www.npmjs.com/package/cookie) to address a [vulnerability](https://github.com/advisories/GHSA-pxg6-pf52-xh8x).
+
+### 5.0.0 - Release date: 2024-09-09
-## 5.0.0 - Release date: 2024-09-09
{: id="5.0.0"}
-Check the [migration guide]({{page.lang}}/guide/migrating-5.html) with all the changes in this new version of Express.
+Check the [migration guide](/{{page.lang}}/guide/migrating-5.html) with all the changes in this new version of Express.
+
+## Express v4
+
+{: id="4.x"}
+
+### 4.21.2 - Release date: 2024-11-06
+
+{: id="4.21.2"}
+
+The 4.21.2 patch release includes one security fix:
+
+- Update [pillajs/path-to-regexp](https://www.npmjs.com/package/path-to-regexp) to address a [vulnerability](https://github.com/advisories/GHSA-rhx6-c78j-4q9w).
+
+### 4.21.1 - Release date: 2024-10-08
-## 4.21.1 - Release date: 2024-10-08
{: id="4.21.1"}
The 4.21.1 patch release includes one security fix:
-* Update [jshttps/cookie](https://www.npmjs.com/package/cookie) to address a [vulnerability](https://github.com/advisories/GHSA-pxg6-pf52-xh8x).
+- Update [jshttps/cookie](https://www.npmjs.com/package/cookie) to address a [vulnerability](https://github.com/advisories/GHSA-pxg6-pf52-xh8x).
+
+### 4.21.0 - Release date: 2024-09-11
-## 4.21.0 - Release date: 2024-09-11
{: id="4.21.0"}
The 4.21.0 minor release includes one new feature:
-* Deprecate `res.location("back")` and `res.redirect("back")` magic string
+- Deprecate `res.location("back")` and `res.redirect("back")` magic string
+
+### 4.20.0 - Release date: 2024-09-10
-## 4.20.0 - Release date: 2024-09-10
{: id="4.20.0"}
The 4.20.0 minor release includes bug fixes and some new features, including:
-* The [`res.clearCookie()` method](/{{ page.lang }}/4x/api.html#res.clearCookie) deprecates `options.maxAge` and `options.expires` options.
-* The [`res.redirect()` method](/{{ page.lang }}/4x/api.html#res.redirect) removes HTML link rendering.
-* The [`express.urlencoded()` method](/{{ page.lang }}/4x/api.html#express.urlencoded) method now has a depth level of `32`, whereas it was previously `Infinity`.
-* Adds support for named matching groups in the routes using a regex
-* Removes encoding of `\`, `|`, and `^` to align better with URL spec
+- The [`res.clearCookie()` method](/{{ page.lang }}/4x/api.html#res.clearCookie) deprecates `options.maxAge` and `options.expires` options.
+- The [`res.redirect()` method](/{{ page.lang }}/4x/api.html#res.redirect) removes HTML link rendering.
+- The [`express.urlencoded()` method](/{{ page.lang }}/4x/api.html#express.urlencoded) method now has a depth level of `32`, whereas it was previously `Infinity`.
+- Adds support for named matching groups in the routes using a regex
+- Removes encoding of `\`, `|`, and `^` to align better with URL spec
For a complete list of changes in this release, see [History.md](https://github.com/expressjs/express/blob/master/History.md#4200--2024-09-10)
-## 4.19.2 - Release date: 2024-03-25
+### 4.19.2 - Release date: 2024-03-25
+
{: id="4.19.2"}
-* Improved fix for open redirect allow list bypass
+- Improved fix for open redirect allow list bypass
For a complete list of changes in this release, see [History.md](https://github.com/expressjs/express/blob/master/History.md#4192--2024-03-25)
-## 4.19.1 - Release date: 2024-03-20
+### 4.19.1 - Release date: 2024-03-20
+
{: id="4.19.1"}
-* Allow passing non-strings to res.location with new encoding handling checks
+- Allow passing non-strings to res.location with new encoding handling checks
For a complete list of changes in this release, see [History.md](https://github.com/expressjs/express/blob/master/History.md#4191--2024-03-20)
-## 4.19.0 - Release date: 2024-03-20
+### 4.19.0 - Release date: 2024-03-20
+
{: id="4.19.0"}
-* Prevent open redirect allow list bypass due to encodeurl
-* deps: cookie@0.6.0
+- Prevent open redirect allow list bypass due to encodeurl
+- deps: cookie@0.6.0
For a complete list of changes in this release, see [History.md](https://github.com/expressjs/express/blob/master/History.md#4190--2024-03-20)
-## 4.18.3 - Release date: 2024-02-29
+### 4.18.3 - Release date: 2024-02-29
+
{: id="4.18.3"}
The 4.18.3 patch release includes the following bug fix:
diff --git a/es/guide/behind-proxies.md b/es/guide/behind-proxies.md
old mode 100755
new mode 100644
index b76847f03c..7e20f8ae65
--- a/es/guide/behind-proxies.md
+++ b/es/guide/behind-proxies.md
@@ -1,22 +1,24 @@
---
layout: page
title: Express detrás de proxies
+description: Learn how to configure Express.js applications to work correctly behind reverse proxies, including using the trust proxy setting to handle client IP addresses.
menu: guide
-lang: es
-description: Learn how to configure Express.js applications to work correctly behind
- reverse proxies, including using the trust proxy setting to handle client IP addresses.
+lang: en
+redirect_from: " "
---
# Express detrás de proxies
-Cuando ejecute una aplicación Express detrás de un proxy, establezca (utilizando [app.set()](/{{ page.lang }}/4x/api.html#app.set)) la variable de aplicación `trust proxy` en uno de los valores de la siguiente tabla.
+When running an Express app behind a reverse proxy, some of the Express APIs may return different values than expected. In order to adjust for this, the `trust proxy` application setting may be used to expose information provided by the reverse proxy in the Express APIs. The most common issue is express APIs that expose the client's IP address may instead show an internal IP address of the reverse proxy.
-Aunque la aplicación no dejará de ejecutarse si no se establece la variable de aplicación `trust proxy`, registrará incorrectamente la dirección IP del proxy como la dirección IP del cliente, a menos que se configure `trust proxy`.
+When configuring the `trust proxy` setting, it is important to understand the exact setup of the reverse proxy. Since this setting will trust values provided in the request, it is important that the combination of the setting in Express matches how the reverse proxy operates.
+The application setting `trust proxy` may be set to one of the values listed in the following table.
+
-Estos son algunos de los muchos controladores de base de datos que hay disponibles. Para ver otras opciones, realice búsquedas en el sitio [npm](https://www.npmjs.com/).
+Estos son algunos de los muchos controladores de base de datos que hay disponibles. Para ver otras opciones, realice búsquedas en el sitio [npm](https://www.npmjs.com/).
-
-
## Cassandra
**Módulo**: [cassandra-driver](https://github.com/datastax/nodejs-driver)
**Instalación**
+###
+
```bash
$ npm install cassandra-driver
```
-**Ejemplo**
+###
-
-
+client.execute('select key from system.local', (err, result) => {
+ if (err) throw err
+ console.log(result.rows[0])
+})
+```
+
+## Couchbase
-
+**Module**: [couchnode](https://github.com/couchbase/couchnode)
+
+###
+
+```bash
+$ npm install couchbase
+```
+
+###
+
+```js
+const couchbase = require('couchbase')
+const bucket = (new couchbase.Cluster('http://localhost:8091')).openBucket('bucketName')
+
+// add a document to a bucket
+bucket.insert('document-key', { name: 'Matt', shoeSize: 13 }, (err, result) => {
+ if (err) {
+ console.log(err)
+ } else {
+ console.log(result)
+ }
+})
+
+// get all documents with shoe size 13
+const n1ql = 'SELECT d.* FROM `bucketName` d WHERE shoeSize = $1'
+const query = N1qlQuery.fromString(n1ql)
+bucket.query(query, [13], (err, result) => {
+ if (err) {
+ console.log(err)
+ } else {
+ console.log(result)
+ }
+})
+```
## CouchDB
**Módulo**: [nano](https://github.com/dscape/nano)
**Instalación**
+###
+
```bash
$ npm install nano
```
-**Ejemplo**
+###
-
-
+// Insert a book document in the books database
+books.insert({ name: 'The Art of war' }, null, (err, body) => {
+ if (err) {
+ console.log(err)
+ } else {
+ console.log(body)
+ }
+})
-
+// Get a list of all books
+books.list((err, body) => {
+ if (err) {
+ console.log(err)
+ } else {
+ console.log(body.rows)
+ }
+})
+```
## LevelDB
**Módulo**: [levelup](https://github.com/rvagg/node-levelup)
**Instalación**
+###
+
```bash
$ npm install level levelup leveldown
```
-**Ejemplo**
-
-
-
+ db.get('name', (err, value) => {
+ if (err) return console.log('Ooops!', err)
-
+ console.log(`name=${value}`)
+ })
+})
+```
## MySQL
**Módulo**: [mysql](https://github.com/felixge/node-mysql/)
**Instalación**
+###
+
```bash
$ npm install mysql
```
-**Ejemplo**
+###
-
-
+ console.log('The solution is: ', rows[0].solution)
+})
-
+connection.end()
+```
## MongoDB
**Módulo**: [mongodb](https://github.com/mongodb/node-mongodb-native)
**Instalación**
+###
+
```bash
$ npm install mongodb
```
-**Ejemplo**
+### Example (v2.\*)
-
-
+MongoClient.connect('mongodb://localhost:27017/animals', (err, db) => {
+ if (err) throw err
-Si desea un controlador de modelo de objeto para MongoDB, consulte [Mongoose](https://github.com/LearnBoost/mongoose).
+ db.collection('mammals').find().toArray((err, result) => {
+ if (err) throw err
+
+ console.log(result)
+ })
+})
+```
+
+###
+
+```js
+const MongoClient = require('mongodb').MongoClient
-
+MongoClient.connect('mongodb://localhost:27017/animals', (err, client) => {
+ if (err) throw err
+
+ const db = client.db('animals')
+
+ db.collection('mammals').find().toArray((err, result) => {
+ if (err) throw err
+
+ console.log(result)
+ })
+})
+```
+
+Si desea un controlador de modelo de objeto para MongoDB, consulte [Mongoose](https://github.com/LearnBoost/mongoose).
## Neo4j
-**Módulo**: [apoc](https://github.com/hacksparrow/apoc)
-**Instalación**
+
+var apoc = require('apoc');apoc.query('match (n) return n').exec().then(
+function (response) {
+console.log(response);
+},
+function (fail) {
+console.log(fail);
+}
+);
+
+###
```bash
-$ npm install apoc
+$ npm install neo4j-driver
```
-**Ejemplo**
+###
-
-
+```js
+const neo4j = require('neo4j-driver')
+const driver = neo4j.driver('neo4j://localhost:7687', neo4j.auth.basic('neo4j', 'letmein'))
-
+const session = driver.session()
+
+session.readTransaction((tx) => {
+ return tx.run('MATCH (n) RETURN count(n) AS count')
+ .then((res) => {
+ console.log(res.records[0].get('count'))
+ })
+ .catch((error) => {
+ console.log(error)
+ })
+})
+```
## Oracle
-**Módulo**: [oracledb](https://github.com/oracle/node-oracledb)
+**Module**: [oracledb](https://github.com/oracle/node-oracledb)
-### Instalación
+###
NOTA: [Vea los requisitos previos de instalación](https://github.com/oracle/node-oracledb#-installation).
@@ -223,7 +283,7 @@ NOTA: [Vea los requisitos previos de instalación](https://github.com/oracle/nod
$ npm install oracledb
```
-### Ejemplo
+###
```js
const oracledb = require('oracledb')
@@ -257,130 +317,182 @@ async function getEmployee (empId) {
getEmployee(101)
```
-
-
-
## PostgreSQL
**Módulo**: [pg-promise](https://github.com/vitaly-t/pg-promise)
**Instalación**
+###
+
```bash
$ npm install pg-promise
```
-**Ejemplo**
-
-
-
-
-
+```js
+const pgp = require('pg-promise')(/* options */)
+const db = pgp('postgres://username:password@host:port/database')
+
+db.one('SELECT $1 AS value', 123)
+ .then((data) => {
+ console.log('DATA:', data.value)
+ })
+ .catch((error) => {
+ console.log('ERROR:', error)
+ })
+```
## Redis
**Módulo**: [redis](https://github.com/mranney/node_redis)
**Instalación**
+###
+
```bash
$ npm install redis
```
-**Ejemplo**
+###
-
-
+**Module**: [tedious](https://github.com/tediousjs/tedious)
-
+###
+
+```bash
+$ npm install tedious
+```
+
+###
+
+```js
+const Connection = require('tedious').Connection
+const Request = require('tedious').Request
+
+const config = {
+ server: 'localhost',
+ authentication: {
+ type: 'default',
+ options: {
+ userName: 'your_username', // update me
+ password: 'your_password' // update me
+ }
+ }
+}
+
+const connection = new Connection(config)
+
+connection.on('connect', (err) => {
+ if (err) {
+ console.log(err)
+ } else {
+ executeStatement()
+ }
+})
+
+function executeStatement () {
+ request = new Request("select 123, 'hello world'", (err, rowCount) => {
+ if (err) {
+ console.log(err)
+ } else {
+ console.log(`${rowCount} rows`)
+ }
+ connection.close()
+ })
+
+ request.on('row', (columns) => {
+ columns.forEach((column) => {
+ if (column.value === null) {
+ console.log('NULL')
+ } else {
+ console.log(column.value)
+ }
+ })
+ })
+
+ connection.execSql(request)
+}
+```
## SQLite
**Módulo**: [sqlite3](https://github.com/mapbox/node-sqlite3)
**Instalación**
+###
+
```bash
$ npm install sqlite3
```
-**Ejemplo**
-
-
-
+ db.each('SELECT rowid AS id, info FROM lorem', (err, row) => {
+ console.log(`${row.id}: ${row.info}`)
+ })
+})
-
+db.close()
+```
## ElasticSearch
**Módulo**: [elasticsearch](https://github.com/elastic/elasticsearch-js)
**Instalación**
+###
+
```bash
$ npm install elasticsearch
```
-**Ejemplo**
+###
-
-
+}).then((response) => {
+ const hits = response.hits.hits
+}, (error) => {
+ console.trace(error.message)
+})
+```
diff --git a/es/guide/debugging.md b/es/guide/debugging.md
old mode 100755
new mode 100644
index 4b4d627258..4194bf6cd1
--- a/es/guide/debugging.md
+++ b/es/guide/debugging.md
@@ -1,10 +1,10 @@
---
layout: page
title: Depuración de Express
+description: Learn how to enable and use debugging logs in Express.js applications by setting the DEBUG environment variable for enhanced troubleshooting.
menu: guide
-lang: es
-description: Learn how to enable and use debugging logs in Express.js applications
- by setting the DEBUG environment variable for enhanced troubleshooting.
+lang: en
+redirect_from: " "
---
# Depuración de Express
@@ -18,7 +18,7 @@ $ DEBUG=express:* node index.js
En Windows, utilice el mandato correspondiente.
```bash
-> set DEBUG=express:* & node index.js
+> $env:DEBUG = "express:*"; node index.js
```
La ejecución de este mandato en la aplicación predeterminada generada por el [generador de Express](/{{ page.lang }}/starter/generator.html) imprime la siguiente salida:
@@ -59,11 +59,11 @@ $ DEBUG=express:* node ./bin/www
express:router:layer new / +1ms
express:router use /users router +0ms
express:router:layer new /users +0ms
- express:router use / <anonymous> +0ms
+ express:router use / <anonymous> +0ms
express:router:layer new / +0ms
- express:router use / <anonymous> +0ms
+ express:router use / <anonymous> +0ms
express:router:layer new / +0ms
- express:router use / <anonymous> +0ms
+ express:router use / <anonymous> +0ms
express:router:layer new / +0ms
```
@@ -89,7 +89,7 @@ Cuando se realiza una solicitud a la aplicación, verá los registros especifica
Para ver sólo los registros de la implementación de direccionador, establezca el valor de `DEBUG` en `express:router`. De la misma forma, para ver sólo los registros de la implementación de aplicación, establezca el valor de `DEBUG` en `express:application`, etc.
-## Aplicaciones generadas por `express`
+## Applications generated by `express`
Una aplicación generada por el mandato `express` utiliza el módulo `debug`, y el ámbito de su espacio de nombres de depuración se establece en el nombre de la aplicación.
@@ -104,3 +104,27 @@ Puede especificar más de un espacio de nombres de depuración asignando una lis
```bash
$ DEBUG=http,mail,express:* node index.js
```
+
+## Advanced options
+
+When running through Node.js, you can set a few environment variables that will change the behavior of the debug logging:
+
+| Name | Purpose |
+| ------------------- | ----------------------------------------------------------------- |
+| `DEBUG` | Enables/disables specific debugging namespaces. |
+| `DEBUG_COLORS` | Whether or not to use colors in the debug output. |
+| `DEBUG_DEPTH` | Object inspection depth. |
+| `DEBUG_FD` | File descriptor to write debug output to. |
+| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
+
+{% capture debug-text %}
+
+The environment variables beginning with `DEBUG_` end up being
+converted into an Options object that gets used with `%o`/`%O` formatters.
+See the Node.js documentation for
+[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
+for the complete list.
+
+{% endcapture %}
+
+{% include admonitions/note.html content=debug-text %}
diff --git a/es/guide/error-handling.md b/es/guide/error-handling.md
old mode 100755
new mode 100644
index 034c9e7476..6b8abb8123
--- a/es/guide/error-handling.md
+++ b/es/guide/error-handling.md
@@ -1,15 +1,189 @@
---
layout: page
title: Manejo de errores de Express
+description: Understand how Express.js handles errors in synchronous and asynchronous code, and learn to implement custom error handling middleware for your applications.
menu: guide
-lang: es
-description: Understand how Express.js handles errors in synchronous and asynchronous
- code, and learn to implement custom error handling middleware for your applications.
+lang: en
+redirect_from: " "
---
-# Manejo de errores
+# Error Handling
-Defina las funciones de middleware de manejo de errores de la misma forma que otras funciones de middleware, excepto que las funciones de manejo de errores tienen cuatro argumentos en lugar de tres: `(err, req, res, next)`. Por ejemplo:
+_Error Handling_ refers to how Express catches and processes errors that
+occur both synchronously and asynchronously. Express comes with a default error
+handler so you don't need to write your own to get started.
+
+## Catching Errors
+
+It's important to ensure that Express catches all errors that occur while
+running route handlers and middleware.
+
+Errors that occur in synchronous code inside route handlers and middleware
+require no extra work. If synchronous code throws an error, then Express will
+catch and process it. For example:
+
+```js
+app.get('/', (req, res) => {
+ throw new Error('BROKEN') // Express will catch this on its own.
+})
+```
+
+Defina las funciones de middleware de manejo de errores de la misma forma que otras funciones de middleware, excepto que las funciones de manejo de errores tienen cuatro argumentos en lugar de tres: `(err, req, res, next)`. For example:
+
+```js
+app.get('/', (req, res, next) => {
+ fs.readFile('/file-does-not-exist', (err, data) => {
+ if (err) {
+ next(err) // Pass errors to Express.
+ } else {
+ res.send(data)
+ }
+ })
+})
+```
+
+Si tiene un manejador de rutas con varias funciones de devolución de llamada, puede utilizar el parámetro `route` para omitir el siguiente manejador de rutas.
+For example:
+
+```js
+app.get('/user/:id', async (req, res, next) => {
+ const user = await getUserById(req.params.id)
+ res.send(user)
+})
+```
+
+If `getUserById` throws an error or rejects, `next` will be called with either
+the thrown error or the rejected value. If no rejected value is provided, `next`
+will be called with a default Error object provided by the Express router.
+
+Si pasa cualquier valor a la función `next()` (excepto la serie `'route'`), Express considera que la solicitud actual tiene un error y omitirá las restantes funciones de middleware y direccionamiento que no son de manejo de errores.
+
+If the callback in a sequence provides no data, only errors, you can simplify
+this code as follows:
+
+```js
+app.get('/', [
+ function (req, res, next) {
+ fs.writeFile('/inaccessible-path', 'data', next)
+ },
+ function (req, res) {
+ res.send('OK')
+ }
+])
+```
+
+In the above example, `next` is provided as the callback for `fs.writeFile`,
+which is called with or without errors. If there is no error, the second
+handler is executed, otherwise Express catches and processes the error.
+
+You must catch errors that occur in asynchronous code invoked by route handlers or
+middleware and pass them to Express for processing. For example:
+
+```js
+app.get('/', (req, res, next) => {
+ setTimeout(() => {
+ try {
+ throw new Error('BROKEN')
+ } catch (err) {
+ next(err)
+ }
+ }, 100)
+})
+```
+
+The above example uses a `try...catch` block to catch errors in the
+asynchronous code and pass them to Express. If the `try...catch`
+block were omitted, Express would not catch the error since it is not part of the synchronous
+handler code.
+
+Use promises to avoid the overhead of the `try...catch` block or when using functions
+that return promises. For example:
+
+```js
+app.get('/', (req, res, next) => {
+ Promise.resolve().then(() => {
+ throw new Error('BROKEN')
+ }).catch(next) // Errors will be passed to Express.
+})
+```
+
+Since promises automatically catch both synchronous errors and rejected promises,
+you can simply provide `next` as the final catch handler and Express will catch errors,
+because the catch handler is given the error as the first argument.
+
+You could also use a chain of handlers to rely on synchronous error
+catching, by reducing the asynchronous code to something trivial. For example:
+
+```js
+app.get('/', [
+ function (req, res, next) {
+ fs.readFile('/maybe-valid-file', 'utf-8', (err, data) => {
+ res.locals.data = data
+ next(err)
+ })
+ },
+ function (req, res) {
+ res.locals.data = res.locals.data.split(',')[1]
+ res.send(res.locals.data)
+ }
+])
+```
+
+The above example has a couple of trivial statements from the `readFile`
+call. If `readFile` causes an error, then it passes the error to Express, otherwise you
+quickly return to the world of synchronous error handling in the next handler
+in the chain. Then, the example above tries to process the data. If this fails, then the
+synchronous error handler will catch it. If you had done this processing inside
+the `readFile` callback, then the application might exit and the Express error
+handlers would not run.
+
+Whichever method you use, if you want Express error handlers to be called in and the
+application to survive, you must ensure that Express receives the error.
+
+## El manejador de errores predeterminado
+
+Express se suministra con un manejador de errores incorporado, que se encarga de los errores que aparecen en la aplicación. Esta función de middleware de manejo de errores predeterminada se añade al final de la pila de funciones de middleware.
+
+Si pasa un error a `next()` y no lo maneja en el manejador de errores, lo manejará el manejador de errores incorporado; el error se escribirá en el cliente con el seguimiento de la pila. El seguimiento de la pila no se incluye en el entorno de producción.
+
+
+Establezca la variable de entorno `NODE_ENV` en `production`, para ejecutar la aplicación en modalidad de producción.
+
+
+When an error is written, the following information is added to the
+response:
+
+- The `res.statusCode` is set from `err.status` (or `err.statusCode`). If
+ this value is outside the 4xx or 5xx range, it will be set to 500.
+- The `res.statusMessage` is set according to the status code.
+- The body will be the HTML of the status code message when in production
+ environment, otherwise will be `err.stack`.
+- Any headers specified in an `err.headers` object.
+
+Si invoca `next()` con un error después de haber empezado a escribir la respuesta (por ejemplo, si encuentra un error mientras se envía la respuesta en modalidad continua al cliente), el manejador de errores predeterminado de Express cierra la conexión y falla la solicitud.
+
+Por lo tanto, cuando añade un manejador de errores personalizado, se recomienda delegar en los mecanismos de manejo de errores predeterminados de Express, cuando las cabeceras ya se han enviado al cliente:
+
+```js
+function errorHandler (err, req, res, next) {
+ if (res.headersSent) {
+ return next(err)
+ }
+ res.status(500)
+ res.render('error', { error: err })
+}
+```
+
+Note that the default error handler can get triggered if you call `next()` with an error
+in your code more than once, even if custom error handling middleware is in place.
+
+Other error handling middleware can be found at [Express middleware](/{{ page.lang }}/resources/middleware.html).
+
+## Writing error handlers
+
+Define error-handling middleware functions in the same way as other middleware functions,
+except error-handling functions have four arguments instead of three:
+`(err, req, res, next)`. For example:
```js
app.use((err, req, res, next) => {
@@ -24,7 +198,10 @@ El middleware de manejo de errores se define al final, después de otras llamada
const bodyParser = require('body-parser')
const methodOverride = require('method-override')
-app.use(bodyParser())
+app.use(bodyParser.urlencoded({
+ extended: true
+}))
+app.use(bodyParser.json())
app.use(methodOverride())
app.use((err, req, res, next) => {
// logic
@@ -39,7 +216,10 @@ A efectos de la organización (y de infraestructura de nivel superior), puede de
const bodyParser = require('body-parser')
const methodOverride = require('method-override')
-app.use(bodyParser())
+app.use(bodyParser.urlencoded({
+ extended: true
+}))
+app.use(bodyParser.json())
app.use(methodOverride())
app.use(logErrors)
app.use(clientErrorHandler)
@@ -57,6 +237,8 @@ function logErrors (err, req, res, next) {
También en este ejemplo, `clientErrorHandler` se define de la siguiente manera; en este caso, el error se pasa de forma explícita al siguiente:
+Notice that when _not_ calling "next" in an error-handling function, you are responsible for writing (and ending) the response. Otherwise, those requests will "hang" and will not be eligible for garbage collection.
+
```js
function clientErrorHandler (err, req, res, next) {
if (req.xhr) {
@@ -66,6 +248,7 @@ function clientErrorHandler (err, req, res, next) {
}
}
```
+
La función que detecta todos los errores de `errorHandler` puede implementarse de la siguiente manera:
```js
@@ -75,17 +258,16 @@ function errorHandler (err, req, res, next) {
}
```
-Si pasa cualquier valor a la función `next()` (excepto la serie `'route'`), Express considera que la solicitud actual tiene un error y omitirá las restantes funciones de middleware y direccionamiento que no son de manejo de errores. Si desea manejar ese error de alguna manera, deberá crear una ruta de manejo de errores como se describe en la siguiente sección.
-
-Si tiene un manejador de rutas con varias funciones de devolución de llamada, puede utilizar el parámetro `route` para omitir el siguiente manejador de rutas. Por ejemplo:
+If you have a route handler with multiple callback functions, you can use the `route` parameter to skip to the next route handler. For example:
```js
app.get('/a_route_behind_paywall',
(req, res, next) => {
if (!req.user.hasPaid) {
-
// continue handling this request
next('route')
+ } else {
+ next()
}
}, (req, res, next) => {
PaidContent.find((err, doc) => {
@@ -94,32 +276,9 @@ app.get('/a_route_behind_paywall',
})
})
```
+
En este ejemplo, se omitirá el manejador `getPaidContent`, pero los restantes manejadores en `app` para `/a_route_behind_paywall` continuarán ejecutándose.
Las llamadas a `next()` y `next(err)` indican que el manejador actual está completo y en qué estado. `next(err)` omitirá los demás manejadores de la cadena, excepto los que se hayan configurado para manejar errores como se ha descrito anteriormente.
-
-## El manejador de errores predeterminado
-
-Express se suministra con un manejador de errores incorporado, que se encarga de los errores que aparecen en la aplicación. Esta función de middleware de manejo de errores predeterminada se añade al final de la pila de funciones de middleware.
-
-Si pasa un error a `next()` y no lo maneja en el manejador de errores, lo manejará el manejador de errores incorporado; el error se escribirá en el cliente con el seguimiento de la pila. El seguimiento de la pila no se incluye en el entorno de producción.
-
-
-Establezca la variable de entorno `NODE_ENV` en `production`, para ejecutar la aplicación en modalidad de producción.
-
-
-Si invoca `next()` con un error después de haber empezado a escribir la respuesta (por ejemplo, si encuentra un error mientras se envía la respuesta en modalidad continua al cliente), el manejador de errores predeterminado de Express cierra la conexión y falla la solicitud.
-
-Por lo tanto, cuando añade un manejador de errores personalizado, se recomienda delegar en los mecanismos de manejo de errores predeterminados de Express, cuando las cabeceras ya se han enviado al cliente:
-
-```js
-function errorHandler (err, req, res, next) {
- if (res.headersSent) {
- return next(err)
- }
- res.status(500)
- res.render('error', { error: err })
-}
-```
diff --git a/es/guide/migrating-4.md b/es/guide/migrating-4.md
old mode 100755
new mode 100644
index 1eee5aca04..c48ad90428
--- a/es/guide/migrating-4.md
+++ b/es/guide/migrating-4.md
@@ -1,15 +1,15 @@
---
layout: page
title: Migración a Express 4
+description: A guide to migrating your Express.js applications from version 3 to 4, covering changes in middleware, routing, and how to update your codebase effectively.
menu: guide
-lang: es
-description: A guide to migrating your Express.js applications from version 3 to 4,
- covering changes in middleware, routing, and how to update your codebase effectively.
+lang: en
+redirect_from: " "
---
# Migración a Express 4
-Visión general+OverviewExpress 4 es un cambio que rompe el código existente de Express 3, etc. Esto implica que una aplicación Express 3 existente no funcionará si actualiza la versión de Express en sus dependencias. @@ -18,7 +18,7 @@ En este artículo se describen:
Los cambios en Express 4@@ -26,7 +26,7 @@ En este artículo se describen: Se han realizado varios cambios importantes en Express 4:
Cambios en el sistema principal y de middleware de Express @@ -53,7 +53,7 @@ middleware necesario para ejecutar la aplicación. Sólo tiene que seguir estos En la tabla siguiente se lista el middleware de Express 3 y su contrapartida en Express 4.
|
app.use
acepta parámetrosapp.use
accepts parametersapp.route()
app.route()
methodexpress.Router
express.Router
classObjeto | -Descripción | +
---|---|
Object | +Description |
Node.js | @@ -195,7 +197,7 @@ Node.js 0.8.x. `http.createServer()`-El módulo `http` ya no es necesario, a menos que necesite trabajar directamente con él (socket.io/SPDY/HTTPS). La aplicación puede iniciarse utilizando la función `app.listen()`. +The `http` module is no longer needed, unless you need to directly work with it (socket.io/SPDY/HTTPS). La aplicación puede iniciarse utilizando la función `app.listen()`. |
app.js
res.send(status)
, donde *`status`* es un número. En su lugar, utilice la función `res.sendStatus(statusCode)`, que establece el código de estado de la cabecera de respuesta HTTP y envía la versión de texto del código: "Not Found", "Internal Server Error", etc.
+Express 5 ya no da soporte a la firma res.send(status)
, donde _`status`_ es un número. En su lugar, utilice la función `res.sendStatus(statusCode)`, que establece el código de estado de la cabecera de respuesta HTTP y envía la versión de texto del código: "Not Found", "Internal Server Error", etc.
Si necesita enviar un número utilizando la función `res.send()`, escríbalo entre comillas para convertirlo en una serie, para que Express no lo interprete como un intento de utilizar la firma antigua no soportada.
+{% include admonitions/note.html content=codemod-deprecated-signatures %}
+
+```js
+// v4
+app.get('/user', (req, res) => {
+ res.send(200)
+})
+
+// v5
+app.get('/user', (req, res) => {
+ res.sendStatus(200)
+})
+```
+
+ | |
![]() |
- Método HTTP para el que se aplica la función de middleware.
+Método HTTP para el que se aplica la función de middleware. |
$ npm install express --save