summaryrefslogtreecommitdiff
path: root/src/index.ts
blob: faa50bb7933c73aa4409fd19188326793b9ee594 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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>