Advanced

Request events

Edit this page

Request events in SolidStart are retrieved using the getRequestEvent from @solidjs/web. These requests happen anywhere on the server.


Locals

SolidStart uses event.locals to pass around a local context where needed.

When adding fields to event.locals, the fields can be typed:

declare module "@solidjs/start/server" {
interface RequestEventLocals {
myNumber: number;
someString: string;
}
}

nativeEvent

Sometimes access is still needed to the underlying event from Vinxi. This can be accessed that using the .nativeEvent property, which is the underlying H3Event used, and can be passed to the helpers available in the ecosystem. Note that Vinxi HTTP helpers do not treeshake so you can only import them in files that do not contain client or isomorphic code.

Many of these events support Async Local Storage so this may not be needed.

Report an issue with this page