File size: 541 Bytes
d1ef1b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/** @type {import('@sveltejs/kit').Handle} */
import { symlink } from 'fs';
import { resolve as pathResolve } from 'path';
import { env } from '$env/dynamic/public';

export async function handle({ event, resolve }) {
	// create symlink to static folder

  const staticPath = pathResolve(env.PUBLIC_FILE_UPLOAD_DIR as string);
  const staticTarget = pathResolve('./build/static');
  symlink(staticPath, staticTarget, (err) => {
    if (err) {
      console.error(err);
    }
  });

	const response = await resolve(event);
	return response;
}