20 lines
631 B
TypeScript
20 lines
631 B
TypeScript
import type { Handle } from '@sveltejs/kit';
|
|
|
|
import { S3_ENDPOINT, S3_BUCKET } from '$env/static/private';
|
|
|
|
import { auth } from '$lib/server/lucia';
|
|
import { ObjectStorageS3 } from '$lib/server/storage/s3';
|
|
import { DatabasePrisma } from '$lib/server/db/prisma';
|
|
|
|
const s3Client = new ObjectStorageS3(S3_ENDPOINT, S3_BUCKET);
|
|
const prismaClient = new DatabasePrisma();
|
|
|
|
export const handle: Handle = async ({ event, resolve }) => {
|
|
event.locals.auth = auth;
|
|
event.locals.database = prismaClient;
|
|
event.locals.objectStorage = s3Client;
|
|
|
|
event.locals.authReq = auth.handleRequest(event);
|
|
|
|
return await resolve(event);
|
|
};
|