From 63639a44d19dfe10b8d0cdb97b6df1644bc590b8 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 14 Mar 2024 20:08:57 +0800 Subject: [PATCH] feat: routes api --- lib/api/index.ts | 4 +++- lib/api/routes/index.ts | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 lib/api/routes/index.ts diff --git a/lib/api/index.ts b/lib/api/index.ts index febb9da9f..ed369cb1c 100644 --- a/lib/api/index.ts +++ b/lib/api/index.ts @@ -1,7 +1,9 @@ import { Hono } from 'hono'; import rules from '@/api/radar/rules'; +import routes from '@/api/routes'; const app = new Hono(); -app.get('/radar/rules.json', rules); +app.get('/radar/rules', rules); +app.get('/routes', routes); export default app; diff --git a/lib/api/routes/index.ts b/lib/api/routes/index.ts new file mode 100644 index 000000000..b94ada752 --- /dev/null +++ b/lib/api/routes/index.ts @@ -0,0 +1,6 @@ +import type { Handler } from 'hono'; +import { namespaces } from '@/registry'; + +const handler: Handler = (ctx) => ctx.json(namespaces); + +export default handler;