-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support custom function routes (#5954)
* feat: support custom function paths * chore: add comments * feat: support redirects
- Loading branch information
1 parent
30f77e0
commit 82b94b5
Showing
16 changed files
with
196 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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
5 changes: 5 additions & 0 deletions
5
...ntegration/__fixtures__/dev-server-with-v2-functions/functions/custom-path-expression.mjs
This file contains 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,5 @@ | ||
export default async (req) => new Response(`With expression path: ${req.url}`) | ||
|
||
export const config = { | ||
path: '/products/:sku', | ||
} |
5 changes: 5 additions & 0 deletions
5
...s/integration/__fixtures__/dev-server-with-v2-functions/functions/custom-path-literal.mjs
This file contains 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,5 @@ | ||
export default async (req) => new Response(`With literal path: ${req.url}`) | ||
|
||
export const config = { | ||
path: '/products', | ||
} |
25 changes: 25 additions & 0 deletions
25
tests/integration/__fixtures__/dev-server-with-v2-functions/netlify.toml
This file contains 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,2 +1,27 @@ | ||
[build] | ||
publish = "public" | ||
|
||
[functions] | ||
directory = "functions" | ||
|
||
[[redirects]] | ||
force = true | ||
from = "/v2-to-legacy-with-force" | ||
status = 200 | ||
to = "/.netlify/functions/custom-path-literal" | ||
|
||
[[redirects]] | ||
from = "/v2-to-legacy-without-force" | ||
status = 200 | ||
to = "/.netlify/functions/custom-path-literal" | ||
|
||
[[redirects]] | ||
force = true | ||
from = "/v2-to-custom-with-force" | ||
status = 200 | ||
to = "/products" | ||
|
||
[[redirects]] | ||
from = "/v2-to-custom-without-force" | ||
status = 200 | ||
to = "/products" |
1 change: 1 addition & 0 deletions
1
tests/integration/__fixtures__/dev-server-with-v2-functions/public/products.html
This file contains 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 @@ | ||
/products from origin |
1 change: 1 addition & 0 deletions
1
...egration/__fixtures__/dev-server-with-v2-functions/public/v2-to-custom-without-force.html
This file contains 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 @@ | ||
/v2-to-custom-without-force from origin |
1 change: 1 addition & 0 deletions
1
...egration/__fixtures__/dev-server-with-v2-functions/public/v2-to-legacy-without-force.html
This file contains 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 @@ | ||
/v2-to-legacy-without-force from origin |
Oops, something went wrong.
82b94b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📊 Benchmark results
82b94b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📊 Benchmark results