Skip to content

Commit a5efb5c

Browse files
feat: rename server route from __kql to __kirby__
1 parent 710e137 commit a5efb5c

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

docs/guide/faq-are-cors-issues-possible.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ No.
66

77
## Detailed Answer
88

9-
With the default module configuration, you won't have to deal with CORS issues. [`useKql`](/api/use-kql) and [`$kql`](/api/kql) pass given queries to the Nuxt server route `/api/__kql`. The query is fetched from the Kirby instance on the server-side and then passed back to the client. Thus, no data is fetched from the Kirby instance on the client-side. It is proxied by the Nuxt server and no CORS issues will occur.
9+
With the default module configuration, you won't have to deal with CORS issues. [`useKql`](/api/use-kql) and [`$kql`](/api/kql) pass given queries to the Nuxt server route `/api/__kirby__`. The query is fetched from the Kirby instance on the server-side and then passed back to the client. Thus, no data is fetched from the Kirby instance on the client-side. It is proxied by the Nuxt server and no CORS issues will occur.

docs/guide/how-it-works.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
## tl;dr
44

5-
The internal `/api/__kql` server route proxies KQL requests to the Kirby instance.
5+
The internal `/api/__kirby__` server route proxies KQL requests to the Kirby instance.
66

77
## Detailed Answer
88

9-
The [`useKql`](/api/use-kql) and [`$kql`](/api/kql) composables will initiate a POST request to the Nuxt server route `/api/__kql` defined by this module. The KQL query will be encoded in the request body.
9+
The [`useKql`](/api/use-kql) and [`$kql`](/api/kql) composables will initiate a POST request to the Nuxt server route `/api/__kirby__` defined by this module. The KQL query will be encoded in the request body.
1010

1111
The internal server route then fetches the actual data for a given query from the Kirby instance and passes the response back to the client. Thus, no KQL requests to the Kirby instance are initiated on the client-side. This proxy behavior has the benefit of omitting CORS issues, since data is sent from server to server.
1212

src/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export default defineNuxtModule<ModuleOptions>({
207207

208208
// Add KQL proxy endpoint to send queries server-side
209209
addServerHandler({
210-
route: '/api/__kql/:key',
210+
route: '/api/__kirby__/:key',
211211
method: 'post',
212212
handler: resolve('runtime/server/handler'),
213213
})

src/runtime/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ModuleOptions } from '../module'
22

33
export function getProxyPath(key: string) {
4-
return `/api/__kql/${encodeURIComponent(key)}`
4+
return `/api/__kirby__/${encodeURIComponent(key)}`
55
}
66

77
export function headersToObject(headers: HeadersInit = {}): Record<string, string> {

0 commit comments

Comments
 (0)