mirror of
https://github.com/expressjs/expressjs.com.git
synced 2026-02-26 02:54:58 +00:00
feat: bottom page navigation component (#2085)
Co-authored-by: Sebastian Beltran <bjohansebas@gmail.com>
This commit is contained in:
16
_config.yml
16
_config.yml
@@ -72,6 +72,20 @@ defaults:
|
|||||||
|
|
||||||
announcement: true # Enable or disable the announcements.
|
announcement: true # Enable or disable the announcements.
|
||||||
|
|
||||||
|
collections:
|
||||||
|
starter:
|
||||||
|
output: true
|
||||||
|
sort_by: order
|
||||||
|
guide:
|
||||||
|
output: true
|
||||||
|
sort_by: order
|
||||||
|
advanced:
|
||||||
|
output: true
|
||||||
|
sort_by: order
|
||||||
|
resources:
|
||||||
|
output: true
|
||||||
|
sort_by: order
|
||||||
|
|
||||||
# Build settings
|
# Build settings
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
@@ -88,7 +102,7 @@ kramdown:
|
|||||||
hard_wrap: false
|
hard_wrap: false
|
||||||
syntax_highlighter: rouge
|
syntax_highlighter: rouge
|
||||||
|
|
||||||
exclude:
|
exclude:
|
||||||
- [uk/CHANGELOG.md]
|
- [uk/CHANGELOG.md]
|
||||||
- vendor/bundle
|
- vendor/bundle
|
||||||
- node_modules/
|
- node_modules/
|
||||||
|
|||||||
46
_includes/bottom-navigation.html
Normal file
46
_includes/bottom-navigation.html
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{% assign current_menu = page.menu %}
|
||||||
|
{% assign current_lang = page.lang %}
|
||||||
|
|
||||||
|
{% if current_menu and current_lang %}
|
||||||
|
|
||||||
|
{% assign all_pages_in_menu = site.pages | where: "menu", current_menu %}
|
||||||
|
{% assign lang_specific_pages = all_pages_in_menu | where: "lang", current_lang %}
|
||||||
|
|
||||||
|
{% assign sorted_pages = lang_specific_pages | sort: "order" %}
|
||||||
|
|
||||||
|
{% for doc in sorted_pages %}
|
||||||
|
{% if doc.path == page.path %}
|
||||||
|
{% assign current_index = forloop.index0 %}
|
||||||
|
{% break %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if current_index != nil %}
|
||||||
|
{% assign prev_index = current_index | minus: 1 %}
|
||||||
|
{% if prev_index >= 0 %}
|
||||||
|
{% assign prev_page = sorted_pages[prev_index] %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% assign next_index = current_index | plus: 1 %}
|
||||||
|
{% if next_index < sorted_pages.size %}
|
||||||
|
{% assign next_page = sorted_pages[next_index] %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if prev_page or next_page %}
|
||||||
|
<nav class="bottom-navigation" aria-label="Pagination">
|
||||||
|
{% if prev_page %}
|
||||||
|
<a href="{{ prev_page.url | relative_url }}" class="bottom-nav-prev">
|
||||||
|
Previous: {{ prev_page.title }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if next_page %}
|
||||||
|
<a href="{{ next_page.url | relative_url }}" class="bottom-nav-next">
|
||||||
|
Next: {{ next_page.title }}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</nav>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li id="resources-menu" class="submenu">
|
<li id="resources-menu" class="submenu">
|
||||||
<a href="/{{ page.lang }}/resources/glossary.html" {% if page.menu=='resources' %} class="active" {% endif %}>
|
<a href="/{{ page.lang }}/resources/community.html" {% if page.menu=='resources' %} class="active" {% endif %}>
|
||||||
{{ site.data[page.lang].menu.resources }}
|
{{ site.data[page.lang].menu.resources }}
|
||||||
</a>
|
</a>
|
||||||
<ul class="submenu-content">
|
<ul class="submenu-content">
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<main>
|
<main>
|
||||||
{{ content }}
|
{{ content }}
|
||||||
|
{% include bottom-navigation.html %}
|
||||||
{% include github-edit-btn.html %}
|
{% include github-edit-btn.html %}
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -688,13 +688,16 @@ div.header-btn {
|
|||||||
color: var(--box-fg);
|
color: var(--box-fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
a.edit-github-btn{
|
a.edit-github-btn,
|
||||||
|
a.bottom-nav-prev,
|
||||||
|
a.bottom-nav-next {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
border-radius: 0.3rem;
|
border-radius: 0.3rem;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
&:is(:hover, :active, :focus) {
|
&:is(:hover, :active, :focus) {
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
@@ -1171,6 +1174,26 @@ h2 a {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 'Prev' left and 'Next' right btn */
|
||||||
|
.bottom-navigation {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-block: 1rem;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-nav-prev {
|
||||||
|
text-align: left;
|
||||||
|
max-width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-nav-next {
|
||||||
|
text-align: right;
|
||||||
|
max-width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
/* routing methods columns */
|
/* routing methods columns */
|
||||||
.methods-columns {
|
.methods-columns {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -1739,3 +1762,4 @@ blockquote {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Performance Best Practices Using Express in Production
|
title: Performance Best Practices Using Express in Production
|
||||||
description: Discover performance and reliability best practices for Express apps in production, covering code optimizations and environment setups for optimal performance.
|
description: Discover performance and reliability best practices for Express apps in production, covering code optimizations and environment setups for optimal performance.
|
||||||
menu: advanced
|
menu: advanced
|
||||||
|
order: 4
|
||||||
redirect_from: "/advanced/best-practice-performance.html"
|
redirect_from: "/advanced/best-practice-performance.html"
|
||||||
---
|
---
|
||||||
# Production best practices: performance and reliability
|
# Production best practices: performance and reliability
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Security Best Practices for Express in Production
|
title: Security Best Practices for Express in Production
|
||||||
description: Discover crucial security best practices for Express apps in production, including using TLS, input validation, secure cookies, and preventing vulnerabilities.
|
description: Discover crucial security best practices for Express apps in production, including using TLS, input validation, secure cookies, and preventing vulnerabilities.
|
||||||
menu: advanced
|
menu: advanced
|
||||||
|
order: 3
|
||||||
redirect_from: "/advanced/best-practice-security.html"
|
redirect_from: "/advanced/best-practice-security.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Developing template engines for Express
|
title: Developing template engines for Express
|
||||||
description: Learn how to develop custom template engines for Express.js using app.engine(), with examples on creating and integrating your own template rendering logic.
|
description: Learn how to develop custom template engines for Express.js using app.engine(), with examples on creating and integrating your own template rendering logic.
|
||||||
menu: advanced
|
menu: advanced
|
||||||
|
order: 1
|
||||||
redirect_from: "/advanced/developing-template-engines.html"
|
redirect_from: "/advanced/developing-template-engines.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Health Checks and Graceful Shutdown
|
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.
|
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
|
menu: advanced
|
||||||
|
order: 5
|
||||||
redirect_from: "/advanced/healthcheck-graceful-shutdown.html"
|
redirect_from: "/advanced/healthcheck-graceful-shutdown.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Express security updates
|
title: Express security updates
|
||||||
description: Review the latest security updates and patches for Express.js, including detailed vulnerability lists for different versions to help maintain a secure application.
|
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
|
menu: advanced
|
||||||
|
order: 2
|
||||||
redirect_from: "/advanced/security-updates.html"
|
redirect_from: "/advanced/security-updates.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Express behind proxies
|
title: Express behind 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.
|
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
|
menu: guide
|
||||||
|
order: 8
|
||||||
redirect_from: "/guide/behind-proxies.html"
|
redirect_from: "/guide/behind-proxies.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Express database integration
|
title: Express database integration
|
||||||
description: Discover how to integrate various databases with Express.js applications, including setup examples for MongoDB, MySQL, PostgreSQL, and more.
|
description: Discover how to integrate various databases with Express.js applications, including setup examples for MongoDB, MySQL, PostgreSQL, and more.
|
||||||
menu: guide
|
menu: guide
|
||||||
|
order: 11
|
||||||
redirect_from: "/guide/database-integration.html"
|
redirect_from: "/guide/database-integration.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Debugging Express
|
title: Debugging Express
|
||||||
description: Learn how to enable and use debugging logs in Express.js applications by setting the DEBUG environment variable for enhanced troubleshooting.
|
description: Learn how to enable and use debugging logs in Express.js applications by setting the DEBUG environment variable for enhanced troubleshooting.
|
||||||
menu: guide
|
menu: guide
|
||||||
|
order: 7
|
||||||
redirect_from: "/guide/debugging.html"
|
redirect_from: "/guide/debugging.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Express error handling
|
title: Express error handling
|
||||||
description: Understand how Express.js handles errors in synchronous and asynchronous code, and learn to implement custom error handling middleware for your applications.
|
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
|
menu: guide
|
||||||
|
order: 6
|
||||||
redirect_from: "/guide/error-handling.html"
|
redirect_from: "/guide/error-handling.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Migrating to Express 4
|
title: Migrating to 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.
|
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
|
menu: guide
|
||||||
|
order: 9
|
||||||
redirect_from: "/guide/migrating-4.html"
|
redirect_from: "/guide/migrating-4.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Migrating to Express 5
|
title: Migrating to Express 5
|
||||||
description: A comprehensive guide to migrating your Express.js applications from version 4 to 5, detailing breaking changes, deprecated methods, and new improvements.
|
description: A comprehensive guide to migrating your Express.js applications from version 4 to 5, detailing breaking changes, deprecated methods, and new improvements.
|
||||||
menu: guide
|
menu: guide
|
||||||
|
order: 10
|
||||||
redirect_from: "/guide/migrating-5.html"
|
redirect_from: "/guide/migrating-5.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Overriding the Express API
|
title: Overriding the Express API
|
||||||
description: Discover how to customize and extend the Express.js API by overriding methods and properties on the request and response objects using prototypes.
|
description: Discover how to customize and extend the Express.js API by overriding methods and properties on the request and response objects using prototypes.
|
||||||
menu: guide
|
menu: guide
|
||||||
|
order: 4
|
||||||
---
|
---
|
||||||
|
|
||||||
# Overriding the Express API
|
# Overriding the Express API
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Express routing
|
title: Express routing
|
||||||
description: Learn how to define and use routes in Express.js applications, including route methods, route paths, parameters, and using Router for modular routing.
|
description: Learn how to define and use routes in Express.js applications, including route methods, route paths, parameters, and using Router for modular routing.
|
||||||
menu: guide
|
menu: guide
|
||||||
|
order: 1
|
||||||
redirect_from: "/guide/routing.html"
|
redirect_from: "/guide/routing.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Using Express middleware
|
title: Using Express middleware
|
||||||
description: Learn how to use middleware in Express.js applications, including application-level and router-level middleware, error handling, and integrating third-party middleware.
|
description: Learn how to use middleware in Express.js applications, including application-level and router-level middleware, error handling, and integrating third-party middleware.
|
||||||
menu: guide
|
menu: guide
|
||||||
|
order: 3
|
||||||
redirect_from: "/guide/using-middleware.html"
|
redirect_from: "/guide/using-middleware.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Using template engines with Express
|
title: Using template engines with Express
|
||||||
description: Discover how to integrate and use template engines like Pug, Handlebars, and EJS with Express.js to render dynamic HTML pages efficiently.
|
description: Discover how to integrate and use template engines like Pug, Handlebars, and EJS with Express.js to render dynamic HTML pages efficiently.
|
||||||
menu: guide
|
menu: guide
|
||||||
|
order: 5
|
||||||
redirect_from: "/guide/using-template-engines.html"
|
redirect_from: "/guide/using-template-engines.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Writing middleware for use in Express apps
|
title: Writing middleware for use in Express apps
|
||||||
description: Learn how to write custom middleware functions for Express.js applications, including examples and best practices for enhancing request and response handling.
|
description: Learn how to write custom middleware functions for Express.js applications, including examples and best practices for enhancing request and response handling.
|
||||||
menu: guide
|
menu: guide
|
||||||
|
order: 2
|
||||||
redirect_from: "/guide/writing-middleware.html"
|
redirect_from: "/guide/writing-middleware.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Express community
|
title: Express community
|
||||||
description: Connect with the Express.js community, learn about the technical committee, find resources, explore community-contributed modules, and get involved in discussions.
|
description: Connect with the Express.js community, learn about the technical committee, find resources, explore community-contributed modules, and get involved in discussions.
|
||||||
menu: resources
|
menu: resources
|
||||||
|
order: 1
|
||||||
redirect_from: "/resources/community.html"
|
redirect_from: "/resources/community.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Contributing to Express
|
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.
|
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
|
menu: resources
|
||||||
|
order: 5
|
||||||
redirect_from: "/resources/community.html"
|
redirect_from: "/resources/community.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Express glossary
|
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.
|
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
|
menu: resources
|
||||||
|
order: 2
|
||||||
redirect_from: "/resources/glossary.html"
|
redirect_from: "/resources/glossary.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: middleware
|
|||||||
title: Express 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.
|
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
|
menu: resources
|
||||||
|
order: 3
|
||||||
redirect_from: "/resources/middleware.html"
|
redirect_from: "/resources/middleware.html"
|
||||||
module: mw-home
|
module: mw-home
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Express utilities
|
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.
|
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
|
menu: resources
|
||||||
|
order: 4
|
||||||
redirect_from: "/resources/utilities.html"
|
redirect_from: "/resources/utilities.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Express basic routing
|
title: Express basic routing
|
||||||
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.
|
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
|
menu: starter
|
||||||
|
order: 4
|
||||||
redirect_from: "/starter/basic-routing.html"
|
redirect_from: "/starter/basic-routing.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -65,4 +66,3 @@ app.delete('/user', (req, res) => {
|
|||||||
|
|
||||||
For more details about routing, see the [routing guide](/{{ page.lang }}/guide/routing.html).
|
For more details about routing, see the [routing guide](/{{ 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)
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Express examples
|
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.
|
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
|
menu: starter
|
||||||
|
order: 6
|
||||||
redirect_from: "/starter/examples.html"
|
redirect_from: "/starter/examples.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -15,6 +16,5 @@ These are some additional examples with more extensive integrations.
|
|||||||
|
|
||||||
{% include community-caveat.html %}
|
{% include community-caveat.html %}
|
||||||
|
|
||||||
- [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
|
- [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)
|
|
||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Express FAQ
|
title: Express FAQ
|
||||||
description: Find answers to frequently asked questions about Express.js, including topics on application structure, models, authentication, template engines, error handling, and more.
|
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
|
menu: starter
|
||||||
|
order: 7
|
||||||
redirect_from: "/starter/faq.html"
|
redirect_from: "/starter/faq.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -93,6 +94,4 @@ middleware function.
|
|||||||
## What version of Node.js does Express require?
|
## What version of Node.js does Express require?
|
||||||
|
|
||||||
* [Express 4.x](/{{ page.lang }}/4x/api.html) requires Node.js 0.10 or higher.
|
* [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.
|
* [Express 5.x](/{{ page.lang }}/5x/api.html) requires Node.js 18 or higher.
|
||||||
|
|
||||||
### [Previous: More examples ](/{{ page.lang }}/starter/examples.html)
|
|
||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Express application generator
|
title: Express application generator
|
||||||
description: Learn how to use the Express application generator tool to quickly create a skeleton for your Express.js applications, streamlining setup and configuration.
|
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
|
menu: starter
|
||||||
|
order: 3
|
||||||
redirect_from: "/starter/generator.html"
|
redirect_from: "/starter/generator.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -123,6 +124,4 @@ The generated app has the following directory structure:
|
|||||||
|
|
||||||
<div class="doc-box doc-info" markdown="1">
|
<div class="doc-box doc-info" markdown="1">
|
||||||
The app structure created by the generator is just one of many ways to structure Express apps. Feel free to use this structure or modify it to best suit your needs.
|
The app structure created by the generator is just one of many ways to structure Express apps. Feel free to use this structure or modify it to best suit your needs.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
### [Previous: Hello World ](/{{ page.lang }}/starter/hello-world.html) [Next: Basic routing](/{{ page.lang }}/starter/basic-routing.html)
|
|
||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Express "Hello World" example
|
title: Express "Hello World" example
|
||||||
description: Get started with Express.js by building a simple 'Hello World' application, demonstrating the basic setup and server creation for beginners.
|
description: Get started with Express.js by building a simple 'Hello World' application, demonstrating the basic setup and server creation for beginners.
|
||||||
menu: starter
|
menu: starter
|
||||||
|
order: 2
|
||||||
redirect_from: "/starter/hello-world.html"
|
redirect_from: "/starter/hello-world.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -46,6 +47,4 @@ Run the app with the following command:
|
|||||||
$ node app.js
|
$ node app.js
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, load `http://localhost:3000/` in a browser to see the output.
|
Then, load `http://localhost:3000/` in a browser to see the output.
|
||||||
|
|
||||||
### [Previous: Installing ](/{{ page.lang }}/starter/installing.html) [Next: Express Generator ](/{{ page.lang }}/starter/generator.html)
|
|
||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Installing Express
|
title: Installing Express
|
||||||
description: Learn how to install Express.js in your Node.js environment, including setting up your project directory and managing dependencies with npm.
|
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
|
menu: starter
|
||||||
|
order: 1
|
||||||
redirect_from: "/starter/installing.html"
|
redirect_from: "/starter/installing.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -48,6 +49,4 @@ $ npm install express --no-save
|
|||||||
|
|
||||||
<div class="doc-box doc-info" markdown="1">
|
<div class="doc-box doc-info" markdown="1">
|
||||||
By default with version npm 5.0+, `npm install` adds the module to the `dependencies` list in the `package.json` file; with earlier versions of npm, you must specify the `--save` option explicitly. Then, afterwards, running `npm install` in the app directory will automatically install modules in the dependencies list.
|
By default with version npm 5.0+, `npm install` adds the module to the `dependencies` list in the `package.json` file; with earlier versions of npm, you must specify the `--save` option explicitly. Then, afterwards, running `npm install` in the app directory will automatically install modules in the dependencies list.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
### [Next: Hello World ](/{{ page.lang }}/starter/hello-world.html)
|
|
||||||
@@ -3,6 +3,7 @@ layout: page
|
|||||||
title: Serving static files in Express
|
title: Serving static files in Express
|
||||||
description: Understand how to serve static files like images, CSS, and JavaScript in Express.js applications using the built-in 'static' middleware.
|
description: Understand how to serve static files like images, CSS, and JavaScript in Express.js applications using the built-in 'static' middleware.
|
||||||
menu: starter
|
menu: starter
|
||||||
|
order: 5
|
||||||
redirect_from: "/starter/static-files.html"
|
redirect_from: "/starter/static-files.html"
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -76,6 +77,4 @@ const path = require('path')
|
|||||||
app.use('/static', express.static(path.join(__dirname, 'public')))
|
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).
|
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)
|
|
||||||
Reference in New Issue
Block a user