Skip to content

External routes file #1573

Answered by raphaelkieling
sistematico asked this question in Q&A
Discussion options

You must be logged in to vote

It should work as well, but the doc itself give you the option to use grouping: https://hono.dev/api/routing#grouping

Your final code would be something like:

import { Hono } from "hono";
import { serve } from "@hono/node-server";
import book from "./routes";

const app = new Hono();

app.route("/books", book);
app.get("/", (c) => c.text("API OK"));
import { Hono } from "hono";

const book = new Hono();

book.get("/test", (c) => {
  return c.text("test");
});

export default book;

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sistematico
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants