HonoXでmiddlewareを使う
as of honox v0.1.23
npm create hono@latestでx-basicを選んで作成したデフォルトのserver.tsはこんな感じ
code:app/server.ts
import { createApp } from 'honox/server'
import { showRoutes } from 'hono/dev'
const app = createApp()
showRoutes(app)
export default app
In the entry file, simply initialize your app using the createApp() function. app will be an instance of Hono, so you can use Hono's middleware and the showRoutes() in hono/dev.
とあるので、loggerもそのままapp.use(logger())みたいにできるかと思ったらできなかった
以下のようにして、createHono()ないしはnew Hono()でbaseのappを作ってあげると良い
code:app/server.ts
import { showRoutes } from 'hono/dev'
import { createApp } from 'honox/server'
import { createHono } from 'honox/factory'
import { logger } from 'hono/logger'
const baseApp = createHono()
baseApp.use(logger())
const app = createApp({app: baseApp})
showRoutes(app)
export default app
ref.