Hono

H

Hono

This is the official Hono discord server for the community

Join

honox asset caching

I'm using honox in my project. In production it creates a signed css and js files + adds all static files located in the public folder as expected. The issue is their cache control is set to public, max-age=0, must-revalidate Is there anyway to control it? I want to cache the css, js and static files forever

Streaming in Honox

Hi Guys, I am trying to use streaming in a honox.js app. ``` // routes/_renderer.tsx...

I want to create a middleware for hono that requires the previous middleware to have some property.

So currently I'm doing a project that have some path like this: /organization/orgSlug/functions... So I want all the methods in functions to have a valid org when I'm accessing them. This means that I need to do 2 things: - Validate that the orgSlug exists in the params - Validate that the orgSlug is pointing to an actual org. ...

basePath as route path

How to use basePath as route path? ```ts const route = new Hono().basePath("/api/file"); const server = new Hono(); server.route((route as any)._basePath, route); // tried this but doesn't work...

@hono/zod-openapi Middleware Issue

Hi there, I need some help in implementing middleware while using hono and @hono/zod-openapi. What I want to implement is running middleware after zod validation of query params but before the actual route handler. My code is as follows:...

Hono and Better-Auth

Hi there, I know this is the better-auth thing, but just asking for a help. This is my auth from api:...

Can not get vercel dev working on localhost with pnpm v10+

I'm using vercel cli v42.1.1 on a windows 11 OS. // package.json ```{ "name": "hono-open-api-starter", "type": "module",...
No description

RPC can't get types

```ts import { hc } from 'hono/client'; import type { AppType } from './index.js'; const c = hc<AppType>('http://localhost:3000');...
No description

RPC frontend import

Did anyone else also have the problem of building the frontend app when importing the RPC Types from the backend? How did you solve it? I don't know what to do anymore... I always get errors on non-existing imports in the frontend - this is pretty easy to understand because they are imports from the backend app. How can I solve it?...

serveStatic() doesn't serve files

I have a simple hono server with a trpc router. Unfortunately the bundled frontend isn't being served by the hono server. And API calls to the /trpc route are intercepted by the app.get('*', serveStatic({ root: '../../front/dist/index.html'})) route and also return a "404 not found". Here is the full code ```ts import { Hono } from 'hono' import { trpcServer } from '@hono/trpc-server'...

Streaming not working with Hono Node Server #4154

Streaming doesn't work. it send the response once it's done processing fully. i tried with the bun dev (not bun server) but somehow it seemed working, really strange. We can run this repo locally: https://github.com/nilooy/my-better-t-app-2 to reproduce it. the suspected code is here: https://github.com/nilooy/my-better-t-app-2/blob/main/apps/server/src/index.ts#L42-L60 ...

RPC

in the docs of the RPC there isn't mentioned anything about redirect. does this mean that using c.redirect('/my-path') work normally without any extra setup to the hono-client?...

Getting cors issues even though i've set it up properly

So i have a frontend client using nextjs and a my api using hono with cloudflare. for some reason my frontend client returns a cors issues but the api proceeds with the requests and returns a 200 repsonse. my cors setup: ```ts app.use("*", (c, next) => {...
No description

import.meta.hot is undefined when using hono with bun.

I am trying to add a function to the dispose callback as documented here: https://bun.sh/docs/bundler/hmr?utm_source=chatgpt.com#import-meta-hot-api-reference but when I log import.meta there isn't even a hot property in there....

Route types for client

I found an example that gives the hc client route types ```const app = new Hono(); const routes = app.get("/api/clock", (c) => { return c.json({ time: new Date().toLocaleTimeString(),...

Trying to send email with Resend and using react, but i got this error

Hi, i want try to sending email with resend and using react as a template but when i hit the endpoint to send that email i got this error. I'm using bun as a runtime
No description

websocket examples for node.js?

I am building a boilerplate using hono.js on the backend and web compoennts (vanilla js) on the client. I'm trying to figure out how to support websockets, but there's not much to go on from the official documentation for node.js

How to wait for streamSse to finish?

I am using hono's streamSSE helper to stream responses, which works great. However it seems that the streamSSE returns right away, and I have no way to await when the streaming is done. I have a middleware that collects metrics such as http request timings, and the middleware also returns immediately from await next() instead of waiting the streaming to be done, so the timings are completely wrong. Is there any way, in the middleware, to wait for the streaming to be done?...

Why isn't my dynamically extended Zod schema enforcing types in @hono/zod-openapi?

Hey folks, I'm running into something weird with @hono/zod-openapi I'm dynamically building a schema like this: ``` export const createChannelSchema = ({ withVideos = false }) => {...

Recommended way to register routes across files

What's the recommended way to register routes across files? I like to have 1 handler per file, and right now I do this: ```js export function registerExampleRoute(app: Hono) { app.get("/example", async (c) => {...