The Comprehensive Guide to Locals in SvelteKit

from blog Stanislav Khromov, | ↗ original
In this blog post we’ll go over a lesser documented but powerful part of SvelteKit – event.locals. Locals are a way to register trusted, server-side, per-request state. The most common use case for locals is to associate some type of data with the current request. Example use cases for locals are: Since locals are per-request, they don’t leak...