FE_Dev / app /api /rpc /[...route] /route.ts
GitHub Actions
Deploy from GitHub Actions [dev] - 2025-10-31 07:28:50
68f7925
import { gradioProxyRoute } from '@/server/routes/gradio-proxy';
import { proposalRoute } from '@/server/routes/proposal';
import { screenshotRoute } from '@/server/routes/screenshot';
import { themeExtractionRoute } from '@/server/routes/theme-extraction';
import { Hono } from 'hono';
import { handle } from 'hono/vercel';
// Route Segment Config: Gradio APIは5〜10分かかるため、タイムアウトを延長
export const maxDuration = 600; // 10分(Vercel Enterpriseプラン)
// Honoアプリケーションの作成
const app = new Hono()
.basePath('/api/rpc')
// エラーハンドラ
.onError((err, c) => {
console.error('Global error:', err);
return c.json(
{
error: {
message: err.message || 'Internal Server Error',
code: 'SYSTEM_ERROR',
},
},
500,
);
})
// 404ハンドラ
.notFound((c) => {
return c.json(
{
error: {
message: 'Not Found',
code: 'NOT_FOUND',
},
},
404,
);
})
// ルーティング
.route('/screenshot', screenshotRoute)
.route('/proposal', proposalRoute)
.route('/gradio-proxy', gradioProxyRoute)
.route('/theme-extraction', themeExtractionRoute);
// Next.js App Routerのエクスポート
export const GET = handle(app);
export const POST = handle(app);
export const PUT = handle(app);
export const DELETE = handle(app);
export const PATCH = handle(app);
// 型エクスポート(APIクライアント用)
export type RpcType = typeof app;