Compare commits
4 Commits
6b839bcdff
...
f8b1b6fd65
| Author | SHA1 | Date | |
|---|---|---|---|
| f8b1b6fd65 | |||
| c90584560d | |||
| 64736ec067 | |||
| e42012d435 |
|
|
@ -1,16 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
name = "repairit"
|
|
||||||
main = "worker.js"
|
|
||||||
compatibility_date = "2026-06-09"
|
|
||||||
|
|
||||||
[assets]
|
|
||||||
directory = "./dist"
|
|
||||||
binding = "ASSETS"
|
|
||||||
Loading…
Reference in New Issue
Block a user