- 移除手动 SPA fallback 逻辑,使用 Cloudflare Assets 原生 SPA 支持 - 修复刷新时认证状态丢失导致跳转首页的问题 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
32 lines
689 B
TypeScript
32 lines
689 B
TypeScript
import { Hono } from 'hono'
|
|
import { cors } from 'hono/cors';
|
|
import { api as providerApi } from './providers'
|
|
import { api as adminApi } from './admin'
|
|
import { fromHono } from 'chanfana';
|
|
|
|
const app = new Hono<HonoCustomType>()
|
|
const openapi = fromHono(app, {
|
|
schema: {
|
|
info: {
|
|
title: 'Awsl One API',
|
|
version: '1.0.0',
|
|
}
|
|
},
|
|
docs_url: '/api/docs',
|
|
redoc_url: '/api/redocs',
|
|
openapi_url: '/api/openapi.json'
|
|
});
|
|
|
|
// cors
|
|
openapi.use('/*', cors());
|
|
// global error handler
|
|
openapi.onError((err, c) => {
|
|
console.error(err)
|
|
return c.text(`${err.name} ${err.message}`, 500)
|
|
})
|
|
|
|
openapi.route('/', providerApi)
|
|
openapi.route('/', adminApi)
|
|
|
|
export default app
|