Skip to content

Commit

Permalink
Need to interact with cloudflare promises inside the fetch handler
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarscher committed Oct 3, 2024
1 parent fdf2ff8 commit 0b70183
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,19 @@ const createApp = (app) => {
return app;
};
let app;
export default {
async fetch(request, env, ctx) {
if (!serve) {
serve = serverEngine({ cmd: "start", loadEntries, env });
}
if (!app) {
const entries = await loadEntries();
const config = await entries.loadConfig();
const honoEnhancer = config.unstable_honoEnhancer || ((createApp) => createApp);
app = honoEnhancer(createApp)(new Hono());
}
return app.fetch(request, env, ctx);
},
};
Expand Down

0 comments on commit 0b70183

Please sign in to comment.