CDN Route

This commit is contained in:
Sean Morley
2024-06-14 11:43:41 +00:00
parent 7894e8c192
commit 272ea60057
3 changed files with 15 additions and 44 deletions

View File

@@ -0,0 +1,14 @@
import { redirect } from "@sveltejs/kit";
import type { PageServerLoad, RouteParams } from "../../../$types";
import { getObjectUrl } from "$lib/server/s3";
export const load = (async (event) => {
const key = event.params.key as string;
const bucket = event.params.bucket as string;
const url = getObjectUrl(bucket, key);
console.log(`Redirecting to ${url}`);
return redirect(302, url);
}) satisfies PageServerLoad;