Skip to content

Commit 7cc1d74

Browse files
authored
Add symlink to "build-output-api/serverless-function" example (vercel#364)
Updates the Serverless Function example to demonstrate how a symbolic link may be used to represent multiple URL paths that will invoke the same underlying Serverless Function. Demo: https://build-output-api-serverless-functions-git-update-build-o-928248.vercel.sh/another
1 parent 25ecb73 commit 7cc1d74

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
index.func

build-output-api/serverless-functions/.vercel/output/functions/index.func/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = (req, res) => {
66
const text =
77
`Howdy ${name}, from Vercel!\n` +
88
`Node.js: ${process.version}\n` +
9+
`Request URL: ${req.url}\n` +
910
`Server time: ${new Date().toISOString()})`
1011
const body = cowsay.say({ text })
1112

build-output-api/serverless-functions/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,9 @@ source code file will be the starting point of execution when the Serverless Fun
2323
Additional files may placed within the `index.func` file as well which will be included in the runtime environment
2424
of the Serverless Function. In this case, there is also a `node_modules` directory
2525
that contains dependencies that the example Serverless Function needs in order to operate.
26+
27+
A second Serverless Function is also included at the path
28+
`.vercel/output/functions/another.func`. In this case, it is represented by using
29+
a symbolic link that points to the `index.func` directory. Because it is a
30+
symlink, Vercel will optimize this by only creating one backing Serverless
31+
Function which is served at both URL paths.

0 commit comments

Comments
 (0)