Node's Package Magician

    nuxt-kirbyql
    TypeScript icon, indicating that this package has built-in type declarations

    0.12.2 • Public • Published

    nuxt-kql

    nuxt-kql

    npm version

    Kirby KQL module for Nuxt 3.

    Features

    • 🔒 Protect your Kirby credentials when sending queries
    • 🪢 Supports token-based authentication with kirby-headless-starter (recommended)
    • 🤹 No CORS issues!
    • 🍱 Handle request just like with the useFetch composable
    • 🗃 Cached query responses
    • 🦾 Strongly typed

    Setup

    📖 Read the documentation

    # pnpm
    pnpm add -D nuxt-kql
    
    # npm
    npm i -D nuxt-kql

    Basic Usage

    📖 Read the documentation

    Add nuxt-kql to your Nuxt config:

    // `nuxt.config.ts`
    import { defineNuxtConfig } from 'nuxt'
    
    export default defineNuxtConfig({
      modules: ['nuxt-kql'],
    })

    And send queries in your template:

    <script setup lang="ts">
    const { data, pending, refresh, error } = await useKql({
      query: 'site',
    })
    </script>
    
    <template>
      <div>
        <h1>{{ data?.result?.title }}</h1>
        <pre>{{ JSON.stringify(data?.result, undefined, 2) }}</pre>
      </div>
    </template>

    💻 Development

    1. Clone this repository
    2. Enable Corepack using corepack enable (use npm i -g corepack for Node.js < 16.10)
    3. Install dependencies using pnpm install
    4. Run pnpm run dev:prepare
    5. Start development server using pnpm run dev

    License

    MIT License © 2022 Johann Schopplich

    Install

    npm i nuxt-kirbyql

    DownloadsWeekly Downloads

    59

    Version

    0.12.2

    License

    MIT

    Unpacked Size

    19.6 kB

    Total Files

    21

    Last publish

    Collaborators

    • johannschopplich