larsen/src/hooks.server.ts

18 lines
476 B
TypeScript
Raw Normal View History

2023-11-19 13:15:37 +00:00
import type { Handle } from '@sveltejs/kit';
import { S3_STORAGE_URL } from '$env/static/private';
import { auth } from '$lib/server/lucia';
import { ObjectStorageS3 } from '$lib/server/storage/s3';
const s3Client = new ObjectStorageS3(S3_STORAGE_URL);
export const handle: Handle = async ({ event, resolve }) => {
event.locals.auth = auth;
event.locals.objectStorage = s3Client;
event.locals.authReq = auth.handleRequest(event);
return await resolve(event);
};