Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This adds support for a new optional file (default
api.ts
) where developers can add custom middleware, non-react endpoints, and define a custom handler based on their deployment needs.Motivations
api.ts
file allows for waku to parameterize useful things at runtime (in future PRs) that would otherwise be difficult in the 08_cookies example linked above. Ex: optional middleware, computed configuration, build info, etc. SeedefineApi
here https://github.com/campbellman/waku/compare/main...campbellman:waku:issue-329-custom-middleware?expand=1#diff-f0671b5207dd962b56acf7e73f1dee3deda53ea547041db5484e5c6eb2ebf58eR54Caveats
api.ts
file to hono for the sake of simplicity. Would need more work to allow users to bring their own providers, eg: express, fastify, etcbuildServerBundle
function to add theapi.ts
file as an entry. But this might need its own config.