database.ts 286 B

123456789
  1. import { Context } from "hono"
  2. import { Database } from "./types"
  3. import { Kysely } from "kysely"
  4. import { D1Dialect } from "kysely-d1"
  5. export const getDB = (c: Context<Environment>) => {
  6. return new Kysely<Database>({
  7. dialect: new D1Dialect({ database: c.env.DB })
  8. })
  9. }