npm run dev –host network: not exposed

You have to add — before the actual flag: npm run dev — –host And it should output: > [email protected] dev > svelte-kit dev “–host” SvelteKit v1.0.0-next.316 local: http://localhost:3000 network: http://***.***.**.**:3000 Note that all files in the following directories will be accessible to anyone on your network: src/lib, src/routes, .svelte-kit, src, node_modules

How do get query string parameter in sveltekit?

The above solutions won’t work. This is the new way: export async function load({ params, url }) { let lang = url.searchParams.get(‘lang’); let q = url.searchParams.get(‘q’); return { lang, q }; } Then, please reach it as this: import { page } from ‘$app/stores’; $page.data.q Thanks to Richard this is much better than acknowledging export … Read more

SvelteKit: how do I do slug-based dynamic routing?

As of SvelteKit 1.0 the path should be a directory in brackets, e.g. for /blog/<slug> you will add the following: src/routes/blog/[slug] |_ +page.js |_ +page.svelte Then in src/routes/blog/[slug]/+page.js you can add something like export const load = ({ params }) => { return { slug: params.slug } } which will return it as a data … Read more

How to route programmatically in SvelteKit?

Answering my own question thanks to Theo from SvelteKit Discord: Use $$app-navigation import { goto } from ‘$app/navigation’; function routeToPage(route: string, replaceState: boolean) { goto(`/${route}`, { replaceState }) } replaceState == true will replace the route instead of adding to the browser history. So, when you click back, you will not go back to the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)