Skip to content

Commit 8596694

Browse files
joshnussSkn0tt
andauthored
feat: SvelteKit update (#1082)
SvelteKit made some routing changes. This PR makes the neccisary updates: - `post` in a server endpoint is now called `POST` - endpoint handlers take an object, and the `request` should be destructured, ie `handler({request})` - endpoint handlers now return a `Response()` object (from [`undici`](https://undici.nodejs.org/)) - to get text of request, call `await request.text()` - default url for vite in development mode is `localhost:5173` - updated link to docs (it changed in latest docs) ## TODO - [x] Update svelte-kit project in examples folder Co-authored-by: Simon Knott <[email protected]>
1 parent 398f53a commit 8596694

File tree

14 files changed

+1700
-697
lines changed

14 files changed

+1700
-697
lines changed

docs/docs/api/sveltekit.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: SvelteKit
33
---
44

5-
```ts title="src/routes/greetingsQueue.ts"
5+
```ts title="src/routes/greetingsQueue/+server.ts"
66
import { Queue } from "quirrel/sveltekit";
77

88
const queue = Queue(
@@ -12,13 +12,13 @@ const queue = Queue(
1212
}
1313
);
1414

15-
export const post = queue
15+
export const POST = queue
1616

1717
export default queue
1818
```
1919

2020
Creates a new Queue.
21-
Make sure to export it from an [endpoint](https://kit.svelte.dev/docs#routing-endpoints), otherwise it won't work.
21+
Make sure to export it as a [server route](https://kit.svelte.dev/docs/routing#server), otherwise it won't work.
2222

2323
#### Parameters
2424

examples/sveltekit/.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.DS_Store
22
node_modules
3-
/.svelte
3+
/.svelte-kit
44
/build
5-
/functions
5+
/functions

0 commit comments

Comments
 (0)