Skip to content

Setting up a project with @azure-net/kit

For full functionality with the package, you need to perform basic configuration of the edges-svelte package. Since edges is already built into the package, the configuration is done directly from the @azure-net/kit package.

Configuring edges

typescript
import { edgesHandle } from '@azure-net/kit/edges/server';
import { dev } from '$app/environment';
import type { Handle } from '@sveltejs/kit';

export const handle: Handle = async ({ event, resolve }) => {
    // Wraps our handle in AsyncLocalStorage to provide each server request with its own context
	return edgesHandle(
		event,
		async ({ edgesEvent, serialize }) => {
			return resolve(edgesEvent, {
				transformPageChunk: ({ html }) => serialize(html)
			});
		},
		dev // This argument accepts true/false and prevents constant Chrome requests to /.well-known/appspecific/com.chrome.devtools.json that clutter the terminal
	);
};