## Demo: url ### Url.svelte ```svelte

``` ### UrlInfo.svelte ```svelte

{label} ({env})

href {url.href}
origin {url.origin}
pathname {url.pathname}
search {url.search || '(empty)'}
hash {url.hash || '(empty)'} {#if isServer}never sent to the server{/if}
{#if getParams().length > 0}

searchParams

{#each getParams() as [key, value] (key)}
{key} {value}
{/each}
{/if}
``` ### routes.ts ```ts import { Mochi } from 'mochi-framework'; import type { MochiRouteValue } from 'mochi-framework'; export const routes: Record = { '/demos/url': Mochi.page('./src/demos/url/Url.svelte'), }; ``` ### index.ts ```ts import { Mochi, logger } from 'mochi-framework'; import { routes } from './routes'; await Mochi.serve({ port: 3333, development: process.env.MODE === 'development', routes, }); logger.info('Server running at http://localhost:3333'); ```