Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dario-piotrowicz/sveltekit-durable-object-local-usage-example
https://github.com/dario-piotrowicz/sveltekit-durable-object-local-usage-example
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dario-piotrowicz/sveltekit-durable-object-local-usage-example
- Owner: dario-piotrowicz
- Created: 2024-02-25T22:38:02.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-02-26T09:31:51.000Z (9 months ago)
- Last Synced: 2024-04-18T06:20:00.314Z (7 months ago)
- Language: JavaScript
- Size: 55.7 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SvelteKit Durable Object Local Usage Example
This is a simple example that shows how to use [`getPlatformProxy`](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy) with SvelteKit's [`handle` hook](https://kit.svelte.dev/docs/hooks#server-hooks-handle) to get access to a local [Durable Object](https://developers.cloudflare.com/durable-objects/) declared and exposed by a [Cloudflare Worker](https://developers.cloudflare.com/workers/).
To run the example:
- install the dependencies:
```sh
$ npm i
```- run the worker and the svelteKit application with:
```sh
$ npm start
```- navigate to the svelteKit home (default `http://localhost:5173/`), you should see the following:
![home](./home.png)
showing a message that gets fetched from the Worker's durable object and displayed in the SvelteKit application