Compare commits
2 Commits
f8b1b6fd65
...
6b839bcdff
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b839bcdff | |||
| 498f91e020 |
16
frontend/worker.js
Normal file
16
frontend/worker.js
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
export default {
|
||||||
|
async fetch(request, env, ctx) {
|
||||||
|
const url = new URL(request.url);
|
||||||
|
|
||||||
|
// Intentar servir el recurso estático desde el binding ASSETS
|
||||||
|
let response = await env.ASSETS.fetch(request);
|
||||||
|
|
||||||
|
// Soporte SPA: Si no existe (404), servir index.html para que React Router maneje la ruta
|
||||||
|
if (response.status === 404) {
|
||||||
|
const indexRequest = new Request(new URL("/index.html", request.url), request);
|
||||||
|
response = await env.ASSETS.fetch(indexRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
};
|
||||||
7
frontend/wrangler.toml
Normal file
7
frontend/wrangler.toml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
name = "repairit"
|
||||||
|
main = "worker.js"
|
||||||
|
compatibility_date = "2026-06-09"
|
||||||
|
|
||||||
|
[assets]
|
||||||
|
directory = "./dist"
|
||||||
|
binding = "ASSETS"
|
||||||
Loading…
Reference in New Issue
Block a user