Replies: 2 comments 4 replies
-
In your node adapter handler you can use polka/express to serve that file path. import { handler } from './build/handler.js';
import express from 'express';
import desm from 'desm';
// Get absolute path to assets folder, "./data/assets" might work fine and you can remove this line/dep
const assetsPath = desm.join(import.meta.url, './data/assets');
const app = express();
// Serve your "data/assets" folder
app.use(express.static(assetsPath))
// let SvelteKit handle everything else, including serving prerendered pages and static assets
app.use(handler);
app.listen(3000, () => {
console.log('listening on port 3000');
}); |
Beta Was this translation helpful? Give feedback.
3 replies
-
Once 'upload' is mentioned in sveltekit, express comes out |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there!
I'm using SvelteKit with Node and want to implement good old Node.js file upload (using fs.writeFile). Uploaded files go into
data/assets
. Now I want to serve assets from both locationsstatic/*
(checked into Git) anddata/assets/*
(where the uploaded files are stored).Is there a way, because
files.assets
in the SvelteKit config only allows specifying one value. Thanks for your help!Beta Was this translation helpful? Give feedback.
All reactions