I have an express server with handerbars to render views, and I want add sapper+svelte for new features. Also I will migrate the old code progressively.
Are there anyway to add sapper/svelte without broke the complete project?
I have an express server with handerbars to render views, and I want add sapper+svelte for new features. Also I will migrate the old code progressively.
Are there anyway to add sapper/svelte without broke the complete project?
You can write a middleware to redirect all the requests to the sapper server via the existent express server
or
in sapper's default template change the current server form polka to express in server.js and then add all the existing routes to the express server
import sirv from 'sirv';
import express from 'express';
import compression from 'compression';
import * as sapper from '@sapper/server';
const { PORT, NODE_ENV } = process.env;
const dev = NODE_ENV === 'development';
express()
.use(
compression({ threshold: 0 }),
sirv('static', { dev }),
sapper.middleware()
)
.listen(PORT, err => {
if (err) console.log('error', err);
});
add all the routes the plugins the middleware and what not !!!