Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const path = require('path');
const express = require('express');
const { createHistory } = require('svelte-routing');
const history = createHistory('memory');
const server = express();
const app = require('./dist/ssr/bundle.js'); // require component
server.use(express.static(path.join(__dirname, 'dist')));
server.get('/cart/*', function(req, res) {
history.replace(req.url);
res.write(`
<div class="grid grid--reverse" id="cart">${app.render()}</div>
`);
res.end();
});
import App from './CartApp.html';
import { createHistory } from 'svelte-routing';
createHistory('browser');
const app = new App({
target: document.getElementById('cart'),
hydrate: true
});