-
Notifications
You must be signed in to change notification settings - Fork 60
Rename Edge Middleware to Routing Middleware / Proxy #229
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
62b69b5
adjust proxy export
dferber90 34c5ba2
rename Edge Middleware to Proxy
dferber90 eb040fa
mv folder
dferber90 7e7a12d
rename featureFlagsInProxy
dferber90 3a695c8
proxy
dferber90 adef84c
Routing Functions → Routing Middleware
dferber90 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../concepts/precompute/manual/middleware.ts → ...s/app/concepts/precompute/manual/proxy.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
examples/snippets/app/examples/feature-flags-in-edge-middleware/flags.ts
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
examples/snippets/app/examples/feature-flags-in-edge-middleware/middleware.ts
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
examples/snippets/app/examples/feature-flags-in-proxy/flags.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { flag } from 'flags/next'; | ||
|
|
||
| export const basicProxyFlag = flag<boolean>({ | ||
| key: 'basic-proxy-flag', | ||
| decide({ cookies }) { | ||
| return cookies.get('basic-proxy-flag')?.value === '1'; | ||
| }, | ||
| }); |
6 changes: 3 additions & 3 deletions
6
...ture-flags-in-edge-middleware/handlers.ts → ...amples/feature-flags-in-proxy/handlers.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,17 @@ | ||
| 'use client'; | ||
|
|
||
| export function actAsFlaggedInUser() { | ||
| document.cookie = 'basic-edge-middleware-flag=1; Path=/'; | ||
| document.cookie = 'basic-proxy-flag=1; Path=/'; | ||
| window.location.reload(); | ||
| } | ||
|
|
||
| export function actAsFlaggedOutUser() { | ||
| document.cookie = 'basic-edge-middleware-flag=0; Path=/'; | ||
| document.cookie = 'basic-proxy-flag=0; Path=/'; | ||
| window.location.reload(); | ||
| } | ||
|
|
||
| export function clear() { | ||
| document.cookie = | ||
| 'basic-edge-middleware-flag=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT'; | ||
| 'basic-proxy-flag=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT'; | ||
| window.location.reload(); | ||
| } |
11 changes: 11 additions & 0 deletions
11
examples/snippets/app/examples/feature-flags-in-proxy/proxy.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { type NextRequest, NextResponse } from 'next/server'; | ||
| import { basicProxyFlag } from './flags'; | ||
|
|
||
| export async function featureFlagsInProxy(request: NextRequest) { | ||
| const active = await basicProxyFlag(); | ||
| const variant = active ? 'variant-on' : 'variant-off'; | ||
|
|
||
| return NextResponse.rewrite( | ||
| new URL(`/examples/feature-flags-in-proxy/${variant}`, request.url), | ||
| ); | ||
| } |
4 changes: 2 additions & 2 deletions
4
...ature-flags-in-edge-middleware/shared.tsx → ...xamples/feature-flags-in-proxy/shared.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.