Unverified Commit ef31084e authored by Lee Robinson's avatar Lee Robinson Committed by GitHub

Update Middleware docs to add version history. (#34302)

Follow up from https://github.com/vercel/next.js/pull/33410.

Adds version history for Middleware so it's more clear it launched in beta, and that we have a place to track changes.
parent 04dae3e7
...@@ -152,26 +152,26 @@ export default async () => { ...@@ -152,26 +152,26 @@ export default async () => {
## Environment Variable Load Order ## Environment Variable Load Order
Depending on the environment (as set by `NODE_ENV`), variables are loaded from the following sources in order from top-to-bottom. In all environments existing env is not overridden by following sources. Depending on the environment (as set by `NODE_ENV`), Environment Variables are loaded from the following sources in top-to-bottom order. In all environments, the existing `env` is not overridden by following sources:
`NODE_ENV=production` `NODE_ENV=production`
- `.env.production.local` 1. `.env.production.local`
- `.env.local` 1. `.env.local`
- `.env.production` 1. `.env.production`
- `.env` 1. `.env`
`NODE_ENV=development` `NODE_ENV=development`
- `.env.development.local` 1. `.env.development.local`
- `.env.local` 1. `.env.local`
- `.env.development` 1. `.env.development`
- `.env` 1. `.env`
`NODE_ENV=test` `NODE_ENV=test`
- `.env.test.local` 1. `.env.test.local`
- `.env.test` 1. `.env.test`
- `.env` 1. `.env`
_(note: `.env.local` is not loaded when `NODE_ENV=test`)_ > **Note:** `.env.local` is not loaded when `NODE_ENV=test`.
...@@ -4,6 +4,16 @@ description: Learn how to use Middleware in Next.js to run code before a request ...@@ -4,6 +4,16 @@ description: Learn how to use Middleware in Next.js to run code before a request
# Middleware # Middleware
<details open>
<summary><b>Version History</b></summary>
| Version | Changes |
| --------- | ------------------------------------------------------------------------------------------ |
| `v12.0.9` | Enforce absolute URLs in Edge Runtime ([PR](https://github.com/vercel/next.js/pull/33410)) |
| `v12.0.0` | Middleware (beta) added. |
</details>
Middleware enables you to use code over configuration. This gives you full flexibility in Next.js, because you can run code before a request is completed. Based on the user's incoming request, you can modify the response by rewriting, redirecting, adding headers, or even streaming HTML. Middleware enables you to use code over configuration. This gives you full flexibility in Next.js, because you can run code before a request is completed. Based on the user's incoming request, you can modify the response by rewriting, redirecting, adding headers, or even streaming HTML.
## Usage ## Usage
...@@ -50,7 +60,7 @@ export type Middleware = ( ...@@ -50,7 +60,7 @@ export type Middleware = (
The function can be a default export and as such, does **not** have to be named `middleware`. Though this is a convention. Also note that you only need to make the function `async` if you are running asynchronous code. The function can be a default export and as such, does **not** have to be named `middleware`. Though this is a convention. Also note that you only need to make the function `async` if you are running asynchronous code.
**Note:** Edge Functions are currently in Beta. The API might change as we look to continually make improvements. [Read the full Middleware API reference.](/docs/api-reference/next/server.md)
## Examples ## Examples
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment