T
TanStack7mo ago
diverse-rose

How would you guy use HonoJS in Start?

I want to migrate my NextJS app with a Hono server inside of it to Start, I implemented as the Hono tutorial. How should I implement it in Start?
26 Replies
diverse-rose
diverse-roseOP7mo ago
Sorry for my poor English, it’s my second language.
stormy-gold
stormy-gold7mo ago
Create a splat API route and add hono's fetch handler in the router function
diverse-rose
diverse-roseOP7mo ago
Can you show me an example?
stormy-gold
stormy-gold7mo ago
GitHub
AttendanceSystem/packages/frontend/app/routes/api/trpc.ts at main ·...
Contribute to Team3132/AttendanceSystem development by creating an account on GitHub.
stormy-gold
stormy-gold7mo ago
Except make it a splat route
stormy-gold
stormy-gold7mo ago
App - Hono - Hono
Web framework built on Web Standards for Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Node.js, and others. Fast, but not only fast.
diverse-rose
diverse-roseOP7mo ago
What do you mean by “splat route”? And just app.fetch?
stormy-gold
stormy-gold7mo ago
Like a catch all in tanstack
diverse-rose
diverse-roseOP7mo ago
Thanks Any issues in a minute I will ask for help again Sorry, it cannot find my API?
// $.ts
import { createAPIFileRoute } from "@tanstack/react-start/api";
import app from "@/app/hono";

export const APIRoute = createAPIFileRoute("/api/$")({
GET: ({ request }) => {
return app.fetch(request);
},

POST: ({ request }) => {
return app.fetch(request);
},
});
// $.ts
import { createAPIFileRoute } from "@tanstack/react-start/api";
import app from "@/app/hono";

export const APIRoute = createAPIFileRoute("/api/$")({
GET: ({ request }) => {
return app.fetch(request);
},

POST: ({ request }) => {
return app.fetch(request);
},
});
// hono/index.ts
import { Hono } from "hono";

const app = new Hono().basePath("/api");

app.get("/", (c) => {
return c.json("Hello World");
});

export default app;
// hono/index.ts
import { Hono } from "hono";

const app = new Hono().basePath("/api");

app.get("/", (c) => {
return c.json("Hello World");
});

export default app;
Wait, I find a GitHub repo who do the same thing as me. Sorry for bothering
diverse-rose
diverse-roseOP7mo ago
diverse-rose
diverse-roseOP7mo ago
I followed this repo. Seems like it doesn't work too? Any solution?
fascinating-indigo
fascinating-indigo7mo ago
Hono Stacks - Hono
Web framework built on Web Standards for Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Node.js, and others. Fast, but not only fast.
fascinating-indigo
fascinating-indigo7mo ago
You can try using hono's rpc client with tanstack query, it should work @sh1ro Later I can try to implement it, right now I'm busy :/
diverse-rose
diverse-roseOP7mo ago
I’m just trying to implement the basic Hono API Route first, let it up and running, I have to understand how Start make its APIs work then adding the validator and database later. Does it need any other requirements? Like the runtime and stuffs?
correct-apricot
correct-apricot7mo ago
Do you have a minimal setup you can share?
diverse-rose
diverse-roseOP7mo ago
Can you wait a bit? I will commit the whole repo to Github later. I really hope you guys can help me, I just want to try basic HonoJS in Start 😭
diverse-rose
diverse-roseOP7mo ago
GitHub
GitHub - Coder-Blue/carbon-news: A news app built with TanStack Sta...
A news app built with TanStack Start and Hono. Contribute to Coder-Blue/carbon-news development by creating an account on GitHub.
diverse-rose
diverse-roseOP7mo ago
Can you take a look at this? How can I implement HonoJS for it?
correct-apricot
correct-apricot7mo ago
The only way i've ever got it to work slightly was the Repo you found, but here you couldn't use serverfunctions, I hope one day we can try as i like HonojS more then H3 and Nitro. I'm hoping once Vinxi is removed it gets easier to bring your own backend, since that is what is forcing them to use nitro
stormy-gold
stormy-gold7mo ago
I believe the plan is to build on nitro
diverse-rose
diverse-roseOP7mo ago
When will that happen?
diverse-rose
diverse-roseOP7mo ago
No description
plain-purple
plain-purple7mo ago
it's working for me
No description
diverse-rose
diverse-roseOP7mo ago
Is that my repo? Any modification on the repo? Like the command to run it? Or runtime thing? I just tested it on my PC... it's working now. But the base path /api/ won't work, can you explain why?
plain-purple
plain-purple7mo ago
seems start issue. tested without hono
No description
diverse-rose
diverse-roseOP7mo ago
Well should we make an issue about this problem? Or just leave it be? Everyone like using their /api/auth and stuffs rather than just /api

Did you find this page helpful?