New to workers, in workers I'm trying to get itty-router to work.
My structure looks like this
src/index.js
src/router/routes.js
index.js
addEventListener('fetch', (event) => {
event.respondWith(router.handle(event.request))
});
routes has:
import { Router } from 'itty-router';
// Create a new router
const router = Router()
/*
Our index route, a simple hello world.
/
router.get("/", () => {
return new Response("Hello, world! This is the root page of your Worker template.")
})
router.all("", () => new Response("404, not found!", { status: 404 }));
export default router;
everytime I execute dev i get [wrangler:inf] GET / 500 Internal Server Error (48ms)
[wrangler:inf] GET /favicon.ico 500 Internal Server Error (2ms)
A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished.
X [ERROR] Uncaught (in response) Error: The script will never generate a response.
[wrangler:inf] GET /favicon.ico 500 Internal Server Error (2ms)
A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished.
X [ERROR] Uncaught (in response) Error: The script will never generate a response.
0 Replies