import { Context, Hono } from 'hono'; // import { ipRestriction } from 'hono/ip-restriction'; import type { KVNamespace } from './env'; import { book, upload, ssr } from './routers/index'; declare global { let my_kv: KVNamespace; } const app = new Hono().basePath('/'); // Register route modules app.route('/book', book); app.route('/upload', upload); app.route('/ssr', ssr); // IP restriction middleware (optional) // app.use( // '*', // ipRestriction( // c => ({ // remote: { // // @ts-expect-error // address: c.req.raw.eo.clientIp, // addressType: // String( // // @ts-expect-error // c.req.raw.eo.clientIp // ).indexOf('::') === -1 // ? 'IPv4' // : 'IPv6' // } // }), // { // denyList: [], // allowList: [ '127.0.0.1', '::1'] // } // ) // ); const notFound = async (c: Context) => { return c.html( `
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Something went wrong on our server. Please try again later.
Error: ${err.message}