mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
5de09288d9
* chore(deps): bump @scalar/hono-api-reference from 0.7.5 to 0.8.0 Bumps [@scalar/hono-api-reference](https://github.com/scalar/scalar/tree/HEAD/integrations/hono) from 0.7.5 to 0.8.0. - [Changelog](https://github.com/scalar/scalar/blob/main/integrations/hono/CHANGELOG.md) - [Commits](https://github.com/scalar/scalar/commits/HEAD/integrations/hono) --- updated-dependencies: - dependency-name: "@scalar/hono-api-reference" dependency-version: 0.8.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * fix: update export name https://github.com/scalar/scalar/commit/81dddd3571d964f17820f503b48707db365d9cb3 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
35 lines
1.5 KiB
TypeScript
35 lines
1.5 KiB
TypeScript
// import { route as rulesRoute, handler as rulesHandler } from '@/api/radar/rules';
|
|
import { route as namespaceAllRoute, handler as namespaceAllHandler } from '@/api/namespace/all';
|
|
import { route as namespaceOneRoute, handler as namespaceOneHandler } from '@/api/namespace/one';
|
|
import { route as radarRulesAllRoute, handler as radarRulesAllHandler } from '@/api/radar/rules/all';
|
|
import { route as radarRulesOneRoute, handler as radarRulesOneHandler } from '@/api/radar/rules/one';
|
|
import { route as categoryOneRoute, handler as categoryOneHandler } from '@/api/category/one';
|
|
import { route as followConfigRoute, handler as followConfigHandler } from '@/api/follow/config';
|
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
import { Scalar } from '@scalar/hono-api-reference';
|
|
|
|
const app = new OpenAPIHono();
|
|
|
|
app.openapi(namespaceAllRoute, namespaceAllHandler);
|
|
app.openapi(namespaceOneRoute, namespaceOneHandler);
|
|
app.openapi(radarRulesAllRoute, radarRulesAllHandler);
|
|
app.openapi(radarRulesOneRoute, radarRulesOneHandler);
|
|
app.openapi(categoryOneRoute, categoryOneHandler);
|
|
app.openapi(followConfigRoute, followConfigHandler);
|
|
|
|
const docs = app.getOpenAPI31Document({
|
|
openapi: '3.1.0',
|
|
info: {
|
|
version: '0.0.1',
|
|
title: 'RSSHub API',
|
|
},
|
|
});
|
|
for (const path in docs.paths) {
|
|
docs.paths[`/api${path}`] = docs.paths[path];
|
|
delete docs.paths[path];
|
|
}
|
|
app.get('/openapi.json', (ctx) => ctx.json(docs));
|
|
app.get('/reference', Scalar({ content: docs }));
|
|
|
|
export default app;
|