From 818f6fdcfbfe296dab032af4023d98a1ac566fcf Mon Sep 17 00:00:00 2001 From: Rikki Date: Mon, 26 May 2025 14:25:17 +0800 Subject: init --- src/index.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/index.ts (limited to 'src/index.ts') diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..faa50bb --- /dev/null +++ b/src/index.ts @@ -0,0 +1,20 @@ +import { Hono } from 'hono' +import { cors } from 'hono/cors' + +const app = new Hono<{ Bindings: Env }>() + +// blog-search +import * as blog_search from './blog_search' +app.use(blog_search.ROUTE_PATH, (c, next) => { + return cors({ + origin: c.env.ALLOWED_ORIGINS, + allowMethods: ['POST'], + allowHeaders: ['Content-Type'], + maxAge: 86400, + })(c, next); +}) +app.post(blog_search.ROUTE_PATH, blog_search.handle) + +export default { + fetch: app.fetch, +} as ExportedHandler -- cgit v1.2.3