Skip to content

How to code large applications with large handlers in multiple files. #2976

Answered by yusukebe
movahhedi asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @movahhedi

I'll answer them:

1 . Can Hono's RPC (with zValidator), handle the types of the requests & responses of all these >2500 routes? Will there be a performance issue with TypeScript?

Unfortunately, it will be impossible. You are right; it will be the issue with TypeScript. To benchmark it, you can create an app with many routes with the following script:

import { writeFile } from 'fs'

const generateRoutes = (count: number) => {
  const imports = `
import { Hono } from 'hono';
import { z } from 'zod';
import { zValidator } from '@hono/zod-validator';
`

  const schema = `
const schema = z.object({
  q: z.string()
})\n
`

  let routes = imports + schema + 'export const app = ne…

Replies: 5 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by movahhedi
Comment options

You must be logged in to vote
1 reply
@yusukebe
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@tomByrer
Comment options

Comment options

You must be logged in to vote
1 reply
@Meess
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants