honox icon indicating copy to clipboard operation
honox copied to clipboard

basePath has no effect on app created by honox createApp

Open monim67 opened this issue 4 months ago • 1 comments

What version of HonoX are you using?

[email protected]

What steps can reproduce the bug?

Setting basePath in the following way doesn't work in server.ts

import { showRoutes } from "hono/dev";
import { createApp } from "honox/server";

const app = createApp().basePath("/api");

showRoutes(app);

export default app;

What is the expected behavior?

Following routes

GET /api GET /api/test

What do you see instead?

Following routes

GET / GET /test

Additional information

No response

monim67 avatar Sep 03 '25 06:09 monim67

Hi @monim67

Currently, you can't specify the base path with your method. You can specify the base path with setting the app option of createApp():

import { Hono } from 'hono'
import { showRoutes } from 'hono/dev'
import { createApp } from 'honox/server'

const baseApp = new Hono().basePath('/api')

const app = createApp({
  app: baseApp
})

showRoutes(app)

export default app

yusukebe avatar Sep 13 '25 00:09 yusukebe