Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Middleware docs to add version history. #34302

Merged
merged 3 commits into from Feb 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 13 additions & 13 deletions docs/basic-features/environment-variables.md
Expand Up @@ -152,26 +152,26 @@ export default async () => {

## 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`

- `.env.production.local`
- `.env.local`
- `.env.production`
- `.env`
1. `.env.production.local`
1. `.env.local`
1. `.env.production`
1. `.env`

`NODE_ENV=development`

- `.env.development.local`
- `.env.local`
- `.env.development`
- `.env`
1. `.env.development.local`
1. `.env.local`
1. `.env.development`
1. `.env`

`NODE_ENV=test`

- `.env.test.local`
- `.env.test`
- `.env`
1. `.env.test.local`
1. `.env.test`
1. `.env`

_(note: `.env.local` is not loaded when `NODE_ENV=test`)_
> **Note:** `.env.local` is not loaded when `NODE_ENV=test`.
12 changes: 11 additions & 1 deletion docs/middleware.md
Expand Up @@ -4,6 +4,16 @@ description: Learn how to use Middleware in Next.js to run code before a request

# 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.

## Usage
Expand Down Expand Up @@ -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.
**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)
leerob marked this conversation as resolved.
Show resolved Hide resolved
## Examples
Expand Down