mirror of
https://github.com/JonasunderscoreJones/blog.jonasjones.dev.git
synced 2025-10-22 21:09:20 +02:00
Added adapter-cloudflare
This commit is contained in:
parent
68f6de3e11
commit
657d8f1ca8
5 changed files with 1438 additions and 5 deletions
1385
package-lock.json
generated
1385
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -10,6 +10,7 @@
|
|||
"check": "svelte-check --tsconfig ./tsconfig.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/adapter-cloudflare": "^4.4.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
||||
"@tsconfig/svelte": "^5.0.2",
|
||||
"svelte": "^4.2.3",
|
||||
|
|
|
@ -5,6 +5,5 @@ import NotFound from './routes/NotFound.svelte';
|
|||
export default {
|
||||
'/': Home,
|
||||
'/lorem/:repeat': Lorem,
|
||||
// The catch-all route must always be last
|
||||
'*': NotFound
|
||||
};
|
||||
|
|
39
src/routes/+error.svelte
Normal file
39
src/routes/+error.svelte
Normal file
|
@ -0,0 +1,39 @@
|
|||
<script context="module" lang="ts">
|
||||
export async function load({ error, status }) {
|
||||
return {
|
||||
status,
|
||||
error: error.message || 'An error occurred'
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export let status: number;
|
||||
export let error: string;
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.error-page {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
}
|
||||
.error-page h1 {
|
||||
font-size: 5rem;
|
||||
margin: 0;
|
||||
}
|
||||
.error-page p {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="error-page">
|
||||
<h1>{status}</h1>
|
||||
<p>{error}</p>
|
||||
{#if status === 404}
|
||||
<p>Sorry, the page you are looking for does not exist.</p>
|
||||
{/if}
|
||||
</div>
|
|
@ -1,7 +1,24 @@
|
|||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
|
||||
import adapter from '@sveltejs/adapter-cloudflare';
|
||||
|
||||
export default {
|
||||
// Consult https://svelte.dev/docs#compile-time-svelte-preprocess
|
||||
// for more information about preprocessors
|
||||
preprocess: vitePreprocess(),
|
||||
|
||||
kit: {
|
||||
adapter: adapter({
|
||||
// See below for an explanation of these options
|
||||
routes: {
|
||||
include: ['/*'],
|
||||
exclude: ['<all>']
|
||||
},
|
||||
platformProxy: {
|
||||
configPath: 'wrangler.toml',
|
||||
environment: undefined,
|
||||
experimentalJsonConfig: false,
|
||||
persist: false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue