-
Hello. routes.get(
"/",
jwt({
secret: config.SECRET_KEY,
}),
async (c) => {
const payload = c.get("jwtPayload"); // any
// ...
}
); In the interface Variables {
jwtPayload: {
sub: string;
};
}
const app = new Hono<{ Variables: Variables }>().basePath("/api");
app.route("/some-route", routes); However, the
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @sz3lbi. interface Variables {
jwtPayload: {
sub: string;
};
}
const routes = new Hono<{ Variables: Variables }>();
routes.get(
"/",
jwt({
secret: config.SECRET_KEY,
}),
async (c) => {
const payload = c.get("jwtPayload"); // probably typed!
// ...
}
);
// ...
const app = new Hono<{ Variables: Variables }>().basePath("/api");
app.route("/some-route", routes); I hope you can resolve this problem. |
Beta Was this translation helpful? Give feedback.
Hi @sz3lbi.
Variables specifications cannot be used in
app.route
.You must specify it when you create your
routes
.I hope you can resolve this problem.