@sveltejs/adapter-netlify
Advanced tools
Comparing version 1.0.0-next.83 to 1.0.0-next.84
{ | ||
"name": "@sveltejs/adapter-netlify", | ||
"version": "1.0.0-next.83", | ||
"version": "1.0.0-next.84", | ||
"repository": { | ||
@@ -35,3 +35,3 @@ "type": "git", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"@sveltejs/kit": "1.0.0-next.529", | ||
"@sveltejs/kit": "1.0.0-next.533", | ||
"@types/node": "^16.11.68", | ||
@@ -38,0 +38,0 @@ "@types/set-cookie-parser": "^2.4.2", |
@@ -53,2 +53,16 @@ # adapter-netlify | ||
```js | ||
import adapter from '@sveltejs/adapter-netlify'; | ||
export default { | ||
kit: { | ||
adapter: adapter({ | ||
// will create a Netlify Edge Function using Deno-based | ||
// rather than using standard Node-based functions | ||
edge: true | ||
}) | ||
} | ||
}; | ||
``` | ||
## Netlify alternatives to SvelteKit functionality | ||
@@ -73,4 +87,12 @@ | ||
With this adapter, SvelteKit endpoints are hosted as [Netlify Functions](https://docs.netlify.com/functions/overview/). Netlify function handlers have additional context, including [Netlify Identity](https://docs.netlify.com/visitor-access/identity/) information. You can access this context via the `event.platform.context` field inside your hooks and endpoints. | ||
With this adapter, SvelteKit endpoints are hosted as [Netlify Functions](https://docs.netlify.com/functions/overview/). Netlify function handlers have additional context, including [Netlify Identity](https://docs.netlify.com/visitor-access/identity/) information. You can access this context via the `event.platform.context` field inside your hooks and `+page.server` or `+layout.server` endpoints. These are [serverless functions](https://docs.netlify.com/functions/overview/) when the `edge` property is `false` in the adapter config or [edge functions](https://docs.netlify.com/edge-functions/overview/#app) when it is `true`. | ||
```js | ||
// +page.server.js | ||
export const load = async (event) => { | ||
const context = event.platform.context; | ||
console.log(context); // shows up in your functions log in the Netlify app | ||
}; | ||
``` | ||
Additionally, you can add your own Netlify functions by creating a directory for them and adding the configuration to your `netlify.toml` file. For example: | ||
@@ -77,0 +99,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
711956
110