I'm trying to create an app that uses ExpressJS as the backend and SvelteKit as the frontend. Express will be the entry point for the web server, so for example /api/ requests will be routed to ExpressJS and anything other than this will be sent to the SvelteKit frontend.
I'm using the node adaptor for SvelteKit and have found that it makes a fully contained node server in '/build/index.js' for the SvelteKit application.
However, this is where I'm stuck now and I'm not sure how to route the requests to the frontend through the Express app. Any help would be much appreciated. I'd ideally like to have this contained within one project.
Link to the node adaptor: https://github.com/sveltejs/kit/blob/master/packages/adapter-node/README.md
I think I worked it out! These two lines solve this in the express app:
import { handler } from './build/handler.js';
app.use(handler);