Skip to content

Commit 40cb5d3

Browse files
committed
docs: update apiDir docs to mention v4 programming model
1 parent cb76f34 commit 40cb5d3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ The directory where the `sk_render` Azure function for SSR will be placed. Most
9494

9595
By default, the adapter will output the `sk_render` Azure function for SSR in the `build/server` folder. If you want to output it to a different directory instead (e.g. if you have additional Azure functions to deploy), you can set this option.
9696

97+
**Note:** since the `sk_render` function is written using the [v4 Node.js programming model](https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=javascript%2Cwindows%2Cazure-cli&pivots=nodejs-model-v4), any other Azure functions you deploy with your Static Web App [need to also be written using v4](https://learn.microsoft.com/en-us/azure/azure-functions/functions-node-upgrade-v4?tabs=v4&pivots=programming-language-javascript).
98+
9799
```js
98100
import azure from 'svelte-adapter-azure-swa';
99101

@@ -130,6 +132,17 @@ custom/
130132
└── index.js
131133
```
132134

135+
The `main` field in your `package.json` [needs to use a glob pattern](https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=javascript%2Cwindows%2Cazure-cli&pivots=nodejs-model-v4#registering-a-function) that includes both the `sk_render/index.js` entrypoint as well as the entrypoints for your other Azure functions. Example `package.json`:
136+
137+
```json
138+
{
139+
"main": "**/index.js",
140+
"dependencies": {
141+
"@azure/functions": "^4"
142+
}
143+
}
144+
```
145+
133146
Also note that the adapter reserves the folder prefix `sk_render` and API route prefix `sk_render` for Azure functions generated by the adapter. So, if you use a custom API directory, you cannot have any other folder starting with `sk_render` or functions available at the `sk_render` route, since these will conflict with the adapter's Azure functions.
134147

135148
### staticDir

0 commit comments

Comments
 (0)