Constant Type unknown #3993
Unanswered
ZubbairHoque
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In the "hono-rpc.ts" within the "lib" folder directory the client is undefined.:
import { AppType } from '@/app/api/[[...route]]/route';
import { hc } from 'hono/client';
console.log('HONO_API_URL:', process.env.HONO_API_URL);
export const client = hc(process.env.HONO_API_URL!) ;
export const api = client.api;
This is how the environment variable is defined:
HONO_API_URL=http://localhost:3000/
The "AppType" is used in the '@/app/api/[[...route]]/route' route:
import { Hono } from "hono";
import { handle } from "hono/vercel";
import { logger } from "hono/logger";
import { HTTPException } from "hono/http-exception";
import documentRoute from "./document";
export const runtime = "edge";
const app = new Hono();
app.use("*", logger());
app.onError((err, c) => {
if (err instanceof HTTPException) {
return err.getResponse();
}
return c.json({ error: "internal error" });
});
const routes = app.basePath("/api").route("/document", documentRoute);
app.get("/", (c) => {
return c.json({
message: "Hello from Ai Resume!",
});
});
export type AppType = typeof routes;
export const GET = handle(app);
export const POST = handle(app);
export const PATCH = handle(app);
Beta Was this translation helpful? Give feedback.
All reactions