hono-vercel-edge-functions
hono-vercel-edge-functions copied to clipboard
Vercel Edge Functions + Hono Router + Wasm + Rust
Vercel Edge Functions + Hono Router + Wasm + Rust
This example shows the following:
- You are able to write Rust code inside
wasm/src
- The Rust code gets compiled to WebAssembly
- The WebAssembly code is used in an API Route using the Edge Runtime
- This API Route can be deployed to Vercel Edge Functions
- The Hono Router is used to write all routes in a single API Route
Note: This example is using Next.js "headless" through the local dev server, using
next dev
to serve API Routes. It's not doing any rendering of pages, so React is not being used. Why? Hono does not currently work with vanilla Vercel Edge Functions, which are served throughvercel dev
. Honov3
adds support for Next.js, which enabled me to create this example.
Example
- https://hono-rust-wasm.vercel.app/api/hello
- https://hono-rust-wasm.vercel.app/api/world
Running Locally
pnpm i
pnpm dev