Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ defaults:

announcement: true # Enable or disable the announcements.

collections:
starter:
output: true
sort_by: order
guide:
output: true
sort_by: order

# Build settings

plugins:
Expand All @@ -88,7 +96,7 @@ kramdown:
hard_wrap: false
syntax_highlighter: rouge

exclude:
exclude:
- [uk/CHANGELOG.md]
- vendor/bundle
- node_modules/
46 changes: 46 additions & 0 deletions _includes/bottom-navigation.html
Original file line number Diff line number Diff line change
@@ -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 %}
1 change: 1 addition & 0 deletions _layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<div class="content">
<main>
{{ content }}
{% include bottom-navigation.html %}
{% include github-edit-btn.html %}
</main>
</div>
Expand Down
23 changes: 22 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -686,13 +686,16 @@ div.header-btn {
color: var(--box-fg);
}

a.edit-github-btn{
a.edit-github-btn,
a.bottom-nav-prev,
a.bottom-nav-next {
display: flex;
gap: 0.5rem;
align-items: center;
width: fit-content;
padding: 0.5rem;
border-radius: 0.3rem;
text-decoration: none;

&:is(:hover, :active, :focus) {
color: var(--fg);
Expand Down Expand Up @@ -1169,6 +1172,24 @@ h2 a {
}
}

/* 'Prev' left and 'Next' right btn */
.bottom-navigation {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
margin: 1rem;
font-weight: 500;
font-size: 1.2rem;
}

.bottom-nav-prev {
text-align: left;
}

.bottom-nav-next {
text-align: right;
}

/* routing methods columns */
.methods-columns {
display: flex;
Expand Down
1 change: 1 addition & 0 deletions en/guide/behind-proxies.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: guide
order: 8
redirect_from: "/guide/behind-proxies.html"
---

Expand Down
1 change: 1 addition & 0 deletions en/guide/database-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
title: Express database integration
description: Discover how to integrate various databases with Express.js applications, including setup examples for MongoDB, MySQL, PostgreSQL, and more.
menu: guide
order: 11
redirect_from: "/guide/database-integration.html"
---

Expand Down
1 change: 1 addition & 0 deletions en/guide/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: guide
order: 7
redirect_from: "/guide/debugging.html"
---

Expand Down
1 change: 1 addition & 0 deletions en/guide/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: guide
order: 6
redirect_from: "/guide/error-handling.html"
---

Expand Down
1 change: 1 addition & 0 deletions en/guide/migrating-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: guide
order: 9
redirect_from: "/guide/migrating-4.html"
---

Expand Down
1 change: 1 addition & 0 deletions en/guide/migrating-5.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: guide
order: 10
redirect_from: "/guide/migrating-5.html"
---

Expand Down
1 change: 1 addition & 0 deletions en/guide/overriding-express-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
title: Overriding the Express API
description: Discover how to customize and extend the Express.js API by overriding methods and properties on the request and response objects using prototypes.
menu: guide
order: 4
---

# Overriding the Express API
Expand Down
1 change: 1 addition & 0 deletions en/guide/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: guide
order: 1
redirect_from: "/guide/routing.html"
---

Expand Down
1 change: 1 addition & 0 deletions en/guide/using-middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: guide
order: 3
redirect_from: "/guide/using-middleware.html"
---

Expand Down
1 change: 1 addition & 0 deletions en/guide/using-template-engines.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: guide
order: 5
redirect_from: "/guide/using-template-engines.html"
---

Expand Down
1 change: 1 addition & 0 deletions en/guide/writing-middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: guide
order: 2
redirect_from: "/guide/writing-middleware.html"
---

Expand Down
2 changes: 1 addition & 1 deletion en/starter/basic-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: starter
order: 4
redirect_from: "/starter/basic-routing.html"
---

Expand Down Expand Up @@ -65,4 +66,3 @@ app.delete('/user', (req, res) => {

For more details about routing, see the [routing guide](/{{ page.lang }}/guide/routing.html).

### [Previous: Express application generator ](/{{ page.lang }}/starter/generator.html)&nbsp;&nbsp;&nbsp;&nbsp;[Next: Serving static files in Express ](/{{ page.lang }}/starter/static-files.html)
5 changes: 2 additions & 3 deletions en/starter/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ 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
order: 6
redirect_from: "/starter/examples.html"
---

Expand All @@ -16,6 +17,4 @@ 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)&nbsp;&nbsp;&nbsp;&nbsp;[Next: FAQ ](/{{ page.lang }}/starter/faq.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
5 changes: 2 additions & 3 deletions en/starter/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: starter
order: 7
redirect_from: "/starter/faq.html"
---

Expand Down Expand Up @@ -93,6 +94,4 @@ middleware function.
## 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)
* [Express 5.x](/{{ page.lang }}/5x/api.html) requires Node.js 18 or higher.
5 changes: 2 additions & 3 deletions en/starter/generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: starter
order: 3
redirect_from: "/starter/generator.html"
---

Expand Down Expand Up @@ -123,6 +124,4 @@ The generated app has the following directory structure:

<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.
</div>

### [Previous: Hello World ](/{{ page.lang }}/starter/hello-world.html)&nbsp;&nbsp;&nbsp;&nbsp;[Next: Basic routing](/{{ page.lang }}/starter/basic-routing.html)
</div>
5 changes: 2 additions & 3 deletions en/starter/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: starter
order: 2
redirect_from: "/starter/hello-world.html"
---

Expand Down Expand Up @@ -46,6 +47,4 @@ Run the app with the following command:
$ node app.js
```

Then, load `http://localhost:3000/` in a browser to see the output.

### [Previous: Installing ](/{{ page.lang }}/starter/installing.html)&nbsp;&nbsp;&nbsp;&nbsp;[Next: Express Generator ](/{{ page.lang }}/starter/generator.html)
Then, load `http://localhost:3000/` in a browser to see the output.
5 changes: 2 additions & 3 deletions en/starter/installing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: starter
order: 1
redirect_from: "/starter/installing.html"
---

Expand Down Expand Up @@ -48,6 +49,4 @@ $ npm install express --no-save

<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.
</div>

### [Next: Hello World ](/{{ page.lang }}/starter/hello-world.html)
</div>
5 changes: 2 additions & 3 deletions en/starter/static-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: page
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.
menu: starter
order: 5
redirect_from: "/starter/static-files.html"
---

Expand Down Expand Up @@ -76,6 +77,4 @@ 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)&nbsp;&nbsp;&nbsp;&nbsp;[Next: More examples ](/{{ page.lang }}/starter/examples.html)
For more details about the `serve-static` function and its options, see [serve-static](/resources/middleware/serve-static.html).