Apity Demo

Apity is library for Svelte and SvelteKit applications designed to simplify working with network requests.

The main benefit of Apity is typing, because each function representing an API call has typed request and response. In order to generate them you need an OpenAPI spec. In this application we use one from Petstore.

We tried to combine here different use cases of the library, and for your convenience each of them is located under a separate route and all examples have a source code snippet.

SSR
Data in this example is fetched in +page.server.ts
Using #await syntax
Svelte way of handling promises in templates.
This example also shows how the request can be reloaded on some action.
Path parameters
Fetching an API route that has a path parameter.
This example also describes the ApiResponse structure
POST request
An example of sending a JSON to server