-
-
Notifications
You must be signed in to change notification settings - Fork 587
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
Allow turning off console.warn
when 404 on Bun serveStatic
adapter
#1810
Comments
Hi @Th1nkK1D, Indeed, you might be right. The purpose of these warnings is to aid in debugging, letting users know which path
I think option |
Hi! Thank you for the fast response.
Then do you think the default value of
I can update those too. |
If we implement PR is welcome! |
I thought it would be useful if the callback function of like this: onNotFound: (c, path) => {
c.env.DB.exec ...
} |
Anyway, I've approved it once and I will merge #1825 into the "next" branch. If you want to introduce it, please create another PR. |
Sorry, I just came back from the holiday. @sor4chi That's a good idea and thank you for opening a PR for that ;) |
This is fixed!!!! |
What is the feature you are proposing?
First of all, I'm willing to open the PR for this since I already modified it on my project but I need some thought.
The current Bun
serveStatic
adapter willconsole.warn
when the requested file is not found.hono/src/adapter/bun/serve-static.ts
Line 52 in 0f33cf8
However, this is not a behavior I want in the production. I want to propose an option to turn off the warning which might be done in 3 ways:
showNotFoundWarning
to theServeStaticOptions
to toggle it on /off.onNotFound
to theServeStaticOptions
as a handler when the 404 error is occurred. The default value can be theconsole.warn
to keep the original behavior.console.warn
.Please let me know what you think :)
The text was updated successfully, but these errors were encountered: