diff options
Diffstat (limited to 'src/index.ts')
| -rw-r--r-- | src/index.ts | 20 |
1 files changed, 20 insertions, 0 deletions
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<Env> |
