11import { drizzle } from "drizzle-orm/d1" ;
22import { createHonoApp } from "./core/hono-app" ;
33import { CacheImpl } from "./utils/cache" ;
4+ import { FaviconService } from "./services/favicon" ;
5+ import { Hono } from "hono" ;
6+ import type { Variables } from "hono/types" ;
7+ import { initContainerMiddleware , timingMiddleware } from "./core/hono-middleware" ;
48
59// Create app instance (singleton)
610let app : ReturnType < typeof createHonoApp > | null = null ;
@@ -20,9 +24,22 @@ export default {
2024 const url = new URL ( request . url ) ;
2125 const path = url . pathname ;
2226
27+ if ( path . startsWith ( '/favicon.ico' ) ) {
28+
29+ const app = new Hono < {
30+ Bindings : Env ;
31+ Variables : Variables ;
32+ } > ( ) ;
33+
34+ app . use ( '*' , timingMiddleware ) ;
35+ app . use ( '*' , initContainerMiddleware ) ;
36+ app . route ( '/' , FaviconService ( ) ) ;
37+ return await app . fetch ( request , env ) ;
38+ }
39+
2340 // Handle RSS feeds directly (native RSS support at root path)
2441 // Matches: /rss.xml, /atom.xml, /rss.json, /feed.json, /feed.xml
25- if ( path . match ( / ^ \/ ( r s s \. x m l | a t o m \. x m l | r s s \. j s o n | f e e d \. j s o n | f e e d \. x m l ) $ / ) || path . startsWith ( '/api/' ) || path . startsWith ( '/favicon.ico' ) ) {
42+ if ( path . match ( / ^ \/ ( r s s \. x m l | a t o m \. x m l | r s s \. j s o n | f e e d \. j s o n | f e e d \. x m l ) $ / ) || path . startsWith ( '/api/' ) ) {
2643 const honoApp = getApp ( ) ;
2744 return await honoApp . fetch ( request , env ) ;
2845 }
0 commit comments