Closed lakuapik closed 2 years ago
i found a simple solution like this:
const handleOptions = (req) => new Response('');
const router = Router();
router.routes.push(['OPTIONS', /(.*)/, [handleOptions]]);
if anyone has another solution, please kindly post it here too. i will close this now, thanks.
i try to use itty-router and deploy it to cloudflare workers. but when there is an OPTIONS request from browser it always return 404 because of
router.all('*', () => new Response('404, Not Found!', { status: 404 }));
how can we handle options request to always return 200 response?
thank you for this awesome router :+1: