mirror of
https://github.com/djdevin/recflare.git
synced 2026-09-09 23:21:30 -07:00
Initial commit
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { httpStatus } from 'http-codex/status'
|
||||
|
||||
import type { Context } from 'hono'
|
||||
import type { APIError } from '../helpers/errors'
|
||||
import type { HonoApp } from '../types'
|
||||
|
||||
/** Handles typical notFound hooks */
|
||||
export function withNotFound<T extends HonoApp>() {
|
||||
return async (ctx: Context<T>): Promise<Response> => {
|
||||
const c = ctx as unknown as Context<HonoApp>
|
||||
|
||||
return c.json(notFoundResponse, httpStatus.NotFound)
|
||||
}
|
||||
}
|
||||
|
||||
export const notFoundResponse = {
|
||||
success: false,
|
||||
error: { message: 'not found' },
|
||||
} satisfies APIError
|
||||
Reference in New Issue
Block a user