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
> The type of the `get` function above comes from `./__types/[id].d.ts`, which is a file generated by SvelteKit (inside your [`outDir`](/docs/configuration#outdir), using the [`rootDirs`](https://www.typescriptlang.org/tsconfig#rootDirs) option) that provides type safety when accessing `params`. See the section on [generated types](/docs/types#generated-types) for more detail.
138
+
> The type of the `GET` function above comes from `./__types/[id].d.ts`, which is a file generated by SvelteKit (inside your [`outDir`](/docs/configuration#outdir), using the [`rootDirs`](https://www.typescriptlang.org/tsconfig#rootDirs) option) that provides type safety when accessing `params`. See the section on [generated types](/docs/types#generated-types) for more detail.
139
139
140
140
To get the raw data instead of the page, you can include an `accept: application/json` header in the request, or β for convenience β append `/__data.json` to the URL, e.g. `/items/[id]/__data.json`.
141
141
@@ -158,13 +158,13 @@ Endpoints can handle any HTTP method β not just `GET` β by exporting the cor
158
158
159
159
```js
160
160
// @noErrors
161
-
exportfunctionpost(event) {...}
162
-
exportfunctionput(event) {...}
163
-
exportfunctionpatch(event) {...}
164
-
exportfunctiondel(event) {...}// `delete` is a reserved word
161
+
exportfunctionPOST(event) {...}
162
+
exportfunctionPUT(event) {...}
163
+
exportfunctionPATCH(event) {...}
164
+
exportfunctionDELETE(event) {...}
165
165
```
166
166
167
-
These functions can, like `get`, return a `body` that will be passed to the page as props. Whereas 4xx/5xx responses from `get` will result in an error page rendering, similar responses to non-GET requests do not, allowing you to do things like render form validation errors:
167
+
These functions can, like `GET`, return a `body` that will be passed to the page as props. Whereas 4xx/5xx responses from `GET` will result in an error page rendering, similar responses to non-GET requests do not, allowing you to do things like render form validation errors:
0 commit comments