add empty chat endpoint

This commit is contained in:
Devin Zuczek
2026-06-12 17:28:00 -04:00
parent 4d1ea9fe3e
commit e89bf3451f
14 changed files with 12762 additions and 493 deletions
+27
View File
@@ -0,0 +1,27 @@
import { Hono } from 'hono'
import { useWorkersLogger } from 'workers-tagged-logger'
import { withNotFound, withOnError } from '@repo/hono-helpers'
import type { App } from './context'
const app = new Hono<App>()
.use(
'*',
// middleware
(c, next) =>
useWorkersLogger(c.env.NAME, {
environment: c.env.ENVIRONMENT,
release: c.env.SENTRY_RELEASE,
})(c, next)
)
.onError(withOnError())
.notFound(withNotFound())
.get('/', (c) => c.json({ service: 'chat', status: 'ok' }))
// Chat threads. No DB binding yet — the C# `ChatController.Get` returns `[]`.
.get('/thread', (c) => c.json([]))
export default app
+14
View File
@@ -0,0 +1,14 @@
import type { HonoApp } from '@repo/hono-helpers'
import type { SharedHonoEnv, SharedHonoVariables } from '@repo/hono-helpers/src/types'
export type Env = SharedHonoEnv & {
// add additional Bindings here
}
/** Variables can be extended */
export type Variables = SharedHonoVariables
export interface App extends HonoApp {
Bindings: Env
Variables: Variables
}
@@ -0,0 +1,20 @@
import { SELF } from 'cloudflare:test'
import { describe, expect, it } from 'vitest'
import '../../chat.app'
const ORIGIN = 'https://chat.rec.djdevin.net'
describe('chat endpoints', () => {
it('GET / reports service status', async () => {
const res = await SELF.fetch(`${ORIGIN}/`)
expect(res.status).toBe(200)
expect(await res.json()).toEqual({ service: 'chat', status: 'ok' })
})
it('GET /thread returns an empty array', async () => {
const res = await SELF.fetch(`${ORIGIN}/thread`)
expect(res.status).toBe(200)
expect(await res.json()).toEqual([])
})
})