hotbelgo
hotbelgo
CDCloudflare Developers
Created by hotbelgo on 1/14/2025 in #pages-help
Pages install does not creates pages wrangler.toml
I have fixed, compiled assets for an SPA, but I need some server side routing to make sure we return index.html in certain cases (basically /prefix/:spa-page-name), and the static assets (css, js, wasm,...) otherwise. I'm following https://developers.cloudflare.com/pages/get-started/c3/ So I do npm create cloudflare@latest and pick hono, but I end up with main = "src/index.ts" in my wrangler.toml and then cloudflare won't deploy it because it needs pages_build_output_dir instead. Also I can see that wrangler.toml can include assets = { directory = "public" } but the docs talk about doing
app.get("/public/*", async (ctx) => {
return await ctx.env.ASSETS.fetch(ctx.req.raw);
});
app.get("/public/*", async (ctx) => {
return await ctx.env.ASSETS.fetch(ctx.req.raw);
});
and the latter has a typescript error Property 'ASSETS' does not exist on type 'CloudflareBindings' although there are no runtime errors Are there any docs for my (I thought really simple) situation because I've got completely lost.
1 replies