nuxt-kql
v1.5.4
Published
Kirby's Query Language API for Nuxt
Downloads
1,905
Maintainers
Readme
Nuxt KQL
Nuxt module for Kirby's Query Language API.
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
- 🦦 Multiple starter kits available
- 🦾 Strongly typed
Setup
[!TIP] 📖 Read the documentation
npx nuxi@latest module add kql
Basic Usage
[!TIP] 📖 Read the documentation
Add the Nuxt KQL module to your Nuxt config:
// `nuxt.config.ts`
export default defineNuxtConfig({
modules: ['nuxt-kql']
})
And send queries in your template:
<script setup lang="ts">
const { data, refresh, error, status, clear } = await useKql({
query: 'site'
})
</script>
<template>
<div>
<h1>{{ data?.result?.title }}</h1>
<pre>{{ JSON.stringify(data?.result, undefined, 2) }}</pre>
</div>
</template>
💻 Development
- Clone this repository
- Enable Corepack using
corepack enable
- Install dependencies using
pnpm install
- Run
pnpm run dev:prepare
- Start development server using
pnpm run dev
License
MIT License © 2022-PRESENT Johann Schopplich