mirror of
https://github.com/get-drexa/drive.git
synced 2025-12-01 22:11:39 +00:00
17 lines
389 B
TypeScript
17 lines
389 B
TypeScript
import { ConvexHttpClient } from "convex/browser"
|
|
import { createMiddleware } from "hono/factory"
|
|
|
|
const _client = new ConvexHttpClient(process.env.CONVEX_URL)
|
|
|
|
export type ConvexContextVariables = {
|
|
convex: ConvexHttpClient
|
|
}
|
|
|
|
export const convexMiddleware = createMiddleware<{
|
|
Variables: ConvexContextVariables
|
|
}>(async (c, next) => {
|
|
c.var
|
|
c.set("convex", _client)
|
|
await next()
|
|
})
|