You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/docs/10-adapters.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,9 +38,9 @@ A variety of official adapters exist for serverless platforms...
38
38
-[`adapter-netlify`](https://github.com/sveltejs/kit/tree/master/packages/adapter-netlify) — for [Netlify](https://netlify.com)
39
39
-[`adapter-vercel`](https://github.com/sveltejs/kit/tree/master/packages/adapter-vercel) — for [Vercel](https://vercel.com)
40
40
41
-
...and others:
41
+
...and traditional platforms:
42
42
43
43
-[`adapter-node`](https://github.com/sveltejs/kit/tree/master/packages/adapter-node) — for creating self-contained Node apps
44
44
-[`adapter-static`](https://github.com/sveltejs/kit/tree/master/packages/adapter-static) — for prerendering your entire site as a collection of static files
45
45
46
-
> The adapter API is still in flux and will likely change before 1.0.
46
+
You may also [write your own](#writing-an-adapter).
We recommend [looking at the source for an adapter](https://github.com/sveltejs/kit/tree/master/packages) to a platform similar to yours and copying it as a starting point.
6
+
7
+
Adapters must implement the following API:
8
+
```
9
+
export default function () {
10
+
/** @type {import('@sveltejs/kit').Adapter} */
11
+
return {
12
+
name: '',
13
+
async adapt({ utils, config }) {
14
+
}
15
+
};
16
+
}
17
+
```
18
+
19
+
Within the `adapt` method, there are a number of things that an adapter should do:
20
+
- Clear out the build directory
21
+
- Provide code that:
22
+
- Calls `init`
23
+
- Converts from the patform's request to a SvelteKit request, call `render`, convert from a SveteKit reponse to the platform's
24
+
- Bundle the output to avoid needing to install dependencies on the target platform, etc. if desired
25
+
- Globally shim `fetch` to work on the target platform. SvelteKit provides a `@sveltejs/kit/install-fetch` helper to use `node-fetch`
26
+
- Call `prerender`
27
+
- Put the user's static files and the generated JS/CSS in the correct location for the target platform
0 commit comments