summaryrefslogtreecommitdiff
path: root/src/app/(main)/api/search/route.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/(main)/api/search/route.ts')
-rw-r--r--src/app/(main)/api/search/route.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/app/(main)/api/search/route.ts b/src/app/(main)/api/search/route.ts
new file mode 100644
index 0000000..3c99f5c
--- /dev/null
+++ b/src/app/(main)/api/search/route.ts
@@ -0,0 +1,11 @@
+import { getPosts } from '@/lib/source';
+import { createSearchAPI } from 'fumadocs-core/search/server';
+
+export const { GET } = createSearchAPI('advanced', {
+ indexes: getPosts().map((page) => ({
+ title: page.data.title,
+ structuredData: page.data.structuredData,
+ id: page.url,
+ url: page.url,
+ })),
+});