reverse proxy for uploads
All checks were successful
Deployment / Deploy website (push) Successful in 2m42s
Deployment / Deploy strapi (push) Successful in 2m45s

This commit is contained in:
Benjamin Palko 2025-05-06 15:14:18 -04:00
parent 0eb91d67dd
commit ce50f8a6d6
8 changed files with 44 additions and 48 deletions

View file

@ -1,30 +1,22 @@
import { env } from "$env/dynamic/private";
import { Strapi } from "$lib/server/strapi";
import type { Handle, HandleServerError } from "@sveltejs/kit";
import { randomUUID } from "crypto";
import { env } from '$env/dynamic/private';
import { Strapi } from '$lib/server/strapi';
import type { Handle, HandleServerError } from '@sveltejs/kit';
import { randomUUID } from 'crypto';
export const handleError: HandleServerError = async ({
error,
event,
message,
status,
}) => {
export const handleError: HandleServerError = async ({ error, event, message, status }) => {
const errorId = randomUUID();
console.error(error, { errorId, event, message, status });
return {
message: "An Internal Error Occurred",
errorId,
message: 'An Internal Error Occurred',
errorId
};
};
export const handle: Handle = async ({ event, resolve }) => {
event.locals = {
strapi: new Strapi(
`http://${env.STRAPI_HOST}:${env.STRAPI_PORT}`,
env.STRAPI_TOKEN,
),
strapi: new Strapi(`http://${env.STRAPI_HOST}:${env.STRAPI_PORT}`, env.STRAPI_TOKEN)
};
const response = await resolve(event);