26 lines
751 B
TypeScript
26 lines
751 B
TypeScript
/* eslint-disable unused-imports/no-unused-vars */
|
|
import { swaggerUI } from '@hono/swagger-ui';
|
|
|
|
import { authApi } from './auth/api';
|
|
import { createHonoApp } from './common/utils';
|
|
import { postApi } from './post/api';
|
|
import { testApi } from './test/api';
|
|
|
|
const app = createHonoApp().basePath('/api');
|
|
app.get('/', (c) => c.text('3R Blog API'));
|
|
app.notFound((c) => c.json({ message: 'Not Found', ok: false }, 404));
|
|
|
|
const routes = app.route('/posts', postApi).route('/test', testApi).route('/auth', authApi);
|
|
type AppType = typeof routes;
|
|
app.doc('/swagger', {
|
|
openapi: '3.1.0',
|
|
info: {
|
|
version: 'v1',
|
|
title: '3R blog API',
|
|
},
|
|
});
|
|
|
|
app.get('/doc', swaggerUI({ url: '/api/swagger' }));
|
|
|
|
export { app, type AppType };
|