reverse proxy for uploads
This commit is contained in:
parent
0eb91d67dd
commit
ce50f8a6d6
8 changed files with 44 additions and 48 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue