Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Passing hono options to the ponder service #1308

Open
peterferguson opened this issue Dec 4, 2024 · 0 comments
Open

[Feature] Passing hono options to the ponder service #1308

peterferguson opened this issue Dec 4, 2024 · 0 comments

Comments

@peterferguson
Copy link

It would be nice to be able to pass the HonoOptions to the base hono instance.

I am trying to implement subdomain routes which in Hono are implemented using getPaths something like this.

const app = new Hono({
  getPath: (req) =>
    '/' +
    req.headers.get('host') +
    req.url.replace(/^https?:\/\/[^/]+(\/[^?]*)/, '$1'),
})

app.get('/www1.example.com/hello', (c) => c.text('hello www1'))

// A following request will match the route:
// new Request('http://www1.example.com/hello', {
//  headers: { host: 'www1.example.com' },
// })

I tried to make a patch that would pass the options from the ponder.config.ts (as below) but it since the hono service seems to be started from the virtualModule it wasn't so easy

const hono: HonoOptions<any> = {
	getPath(request, options) {
		// do stuff with subdomains
	},
}

export default createConfig({
	database,
	hono,
	networks,
	contracts: {
		...
	},
})

Is there a better way to implement this right now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant