-
-
Notifications
You must be signed in to change notification settings - Fork 840
Open
Labels
enhancementNew feature or request.New feature or request.
Description
What is the feature you are proposing?
I'm in a context where I'm creating re-usable Hono apps that can be used on different base path endpoints such as /apps/myapp1 and /apps/myapp2 but the app is not aware of that path until a request comes in.
The environment includes the base path for the app as a header on incoming http requests, i.e. X-BASE-PATH: /apps/myapp1.
The current basePath method is configured on a Hono app without a context.
I'd like a way to configure the base class for routing using some information from the context. Something like:
const api = new Hono().basePath(c => c.req.header('X-BASE-PATH'))
api.get('/book', (c) => c.text('List Books')) // if `X-BASE-PATH: /apps/myapp1` then GET /apps/myapp1/bookMetadata
Metadata
Assignees
Labels
enhancementNew feature or request.New feature or request.