Skip to content

Commit 5e93353

Browse files
authored
fix: move skills endpoints to server/routes (#634)
1 parent 0f945f8 commit 5e93353

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

nuxt.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ export default defineNuxtConfig({
9393
'/opensearch.xml': { isr: true },
9494
'/**': { isr: 60 },
9595
'/package/**': { isr: 60 },
96+
'/:pkg/.well-known/skills/**': { isr: 3600 },
97+
'/:scope/:pkg/.well-known/skills/**': { isr: 3600 },
9698
// never cache
9799
'/search': { isr: false, cache: false },
98100
'/api/auth/**': { isr: false, cache: false },
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,8 @@ import { CACHE_MAX_AGE_ONE_HOUR, CACHE_MAX_AGE_ONE_YEAR } from '#shared/utils/co
66

77
/**
88
* Serves /.well-known/skills endpoints for `npx skills add` CLI.
9-
* Middleware pattern allows non-matching paths to pass through to Nuxt.
109
*/
11-
export default defineEventHandler(event => {
12-
const url = getRequestURL(event)
13-
const match = url.pathname.match(/^\/(.+?)\/\.well-known\/skills\/(.*)$/)
14-
if (!match) return
15-
16-
return cachedHandler(event)
17-
})
18-
19-
const cachedHandler = defineCachedEventHandler(
10+
export default defineCachedEventHandler(
2011
async (event: H3Event) => {
2112
const url = getRequestURL(event)
2213
const match = url.pathname.match(/^\/(.+?)\/\.well-known\/skills\/(.*)$/)!
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from '../.well-known-skills'

0 commit comments

Comments
 (0)