-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] allow +server.js files next to +page files
Closes #5896
- Loading branch information
1 parent
e20425f
commit 95c9eef
Showing
8 changed files
with
127 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@sveltejs/kit': patch | ||
--- | ||
|
||
[feat] allow +server.js files next to +page files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/kit/test/apps/basics/src/routes/routing/endpoint-next-to-page/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script> | ||
let result; | ||
/** @param {string} method */ | ||
async function request(method) { | ||
result = 'loading'; | ||
const response = await fetch('/routing/endpoint-next-to-page', {method}); | ||
result = await response.text(); | ||
} | ||
</script> | ||
|
||
<p>Hi</p> | ||
<button on:click={() => request('GET')}>GET</button> | ||
<button on:click={() => request('PUT')}>PUT</button> | ||
<button on:click={() => request('PATCH')}>PATCH</button> | ||
<button on:click={() => request('POST')}>POST</button> | ||
<button on:click={() => request('DELETE')}>DELETE</button> | ||
<pre>{result}</pre> |
24 changes: 24 additions & 0 deletions
24
packages/kit/test/apps/basics/src/routes/routing/endpoint-next-to-page/+server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** @type {import('./$types').RequestHandler} */ | ||
export function GET() { | ||
return new Response('GET'); | ||
} | ||
|
||
/** @type {import('./$types').RequestHandler} */ | ||
export function PUT() { | ||
return new Response('PUT'); | ||
} | ||
|
||
/** @type {import('./$types').RequestHandler} */ | ||
export function PATCH() { | ||
return new Response('PATCH'); | ||
} | ||
|
||
/** @type {import('./$types').RequestHandler} */ | ||
export function POST() { | ||
return new Response('POST'); | ||
} | ||
|
||
/** @type {import('./$types').RequestHandler} */ | ||
export function DELETE() { | ||
return new Response('DELETE'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters