0.12.2 โ€ข Published 2 years ago

nuxt-kirbyql v0.12.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

0.12.2

2 years ago

0.9.2

2 years ago

0.9.1

2 years ago