How to use the sapper/core.js.create_routes function in sapper

To help you get started, we’ve selected a few sapper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sveltejs / sapper / src / middleware / TO_MOVE_create_watcher.ts View on Github external
watch_files('routes/**/*.+(html|js|mjs)', () => {
		const routes = create_routes({ src });
		onroutes(routes);

		create_app({ routes, src, dev });
	});
github sveltejs / sapper / src / middleware / TO_MOVE_create_watcher.ts View on Github external
]).then(([client_stats, server_stats]) => {
		const client_info = client_stats.toJson();
		fs.writeFileSync(path.join(dest, 'stats.client.json'), JSON.stringify(client_info, null, '  '));

		const server_info = server_stats.toJson();
		fs.writeFileSync(path.join(dest, 'stats.server.json'), JSON.stringify(server_info, null, '  '));

		const client_files = client_info.assets.map((chunk: { name: string }) => `/client/${chunk.name}`);

		return create_serviceworker({
			routes: create_routes({ src }),
			client_files,
			src
		});
	});