honojs / hono

Web framework built on Web Standards
https://hono.dev
MIT License
19.06k stars 542 forks source link

Custom transformers to serialize/deserialize more complex types #1559

Open ptrxyz opened 12 months ago

ptrxyz commented 12 months ago

What is the feature you are proposing?

I wonder what the developers think of allowing the use of custom transformers to enable Hono RPC to work with more complex data types (i.e. Date, Set, undefined, etc).

tRPC for example uses superjson or devalue and it seems to work quite well. Are there any plans for Hono to support something similar?

yusukebe commented 12 months ago

Hi @ptrxyz

There are no plans to support this in the core of Hono, but it would be nice to create a third-party middleware or helper.

This article is very interesting because it uses Superjson to handle Date types both on the server and on the client. It's written in Japanese, but you can read the code.

https://zenn.dev/kosei28/articles/hono-superjson