Auth
With Routify, you don't need any router included functions to authenticate users and protect your app.
Since everything in Routify is scoped, protecting a layout automatically protects all nested components recursively.
Authentication guards
Users should generally be authenticated in the root layout.
              <!-- src/pages/_layout.svelte -->
              <script>
                import { authenticate } from 'my-auth-service'
              </script>
              <!-- Wait with rendering the app till the user/guest is verified.
              This prevents small UI glitches and premature authorization checks. -->
              {#await authenticate()}
              {:then}
                <slot />
              {/await}
             <!-- src/pages/_layout.svelte -->
<script>
  import { authenticate } from 'my-auth-service'
</script>
<!-- Wait with rendering the app till the user/guest is verified.
This prevents small UI glitches and premature authorization checks. -->
{#await authenticate()}
{:then}
  <slot />
{/await}Authorization Guards
Guards should be implemented in the component or module which they protect.
              <!-- src/pages/admin/_layout.svelte -->
              <script>
                export let scoped
              </script>
              {#if scoped.user.isAdmin}
                <slot />
              {/if}
               <!-- src/pages/admin/_layout.svelte -->
<script>
  export let scoped
</script>
{#if scoped.user.isAdmin}
  <slot />
{/if}Realtime guards
For realtime guards, simply replace
      {#await <promise>}
      with
      {#if <reactive condition>}
SSR / Static
If you use spank, spassr --ssr or our starter
      template's serverless SSR functions, you need to call
      $ready() to let tossr know that the page is
      ready to be rendered. Otherwise tossr would wait indefinitely
      for your page (eg. index.svelte) to load.
                <!-- src/pages/_layout.svelte -->
                <script>
                  import { $ready } from '@roxi/routify'
                  ...
                </script>
                {#if condition}
                  <slot />
                {:else}
                  { $ready() }
                {/if}
             <!-- src/pages/_layout.svelte -->
<script>
  import { $ready } from '@roxi/routify'
  ...
</script>
{#if condition}
  <slot />
{:else}
  { $ready() }
{/if}Writing good documentation that is up-to-date is difficult. If you notice a mistake, help us out.