![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@cfworker/web
Advanced tools
Web framework for Cloudflare Workers and service workers, inspired by Koa
Web framework for Cloudflare Workers and service workers, inspired by Koa.
For a compatible router, check out @cfworker/web-router.
import { Application, Middleware } from '@cfworker/web';
// Exception handler middleware example:
const exceptionHandler: Middleware = async (context, next) => {
const { res, accepts } = context;
try {
await next();
} catch (err) {
res.status = 500;
if (accepts.media('text/html')) {
res.body = `<h1>Internal Server Error</h1><p><pre><code>${err.stack}</code></pre></p>`;
res.headers.set('content-type', 'text/html');
} else {
res.body = `Internal Server Error\n${err.stack}`;
res.headers.set('content-type', 'text/plain');
}
}
};
// Simple request handler middleware. Consider using @cfworker/web-router for more advanced scenarios.
const requestHandler: Middleware = context => {
const { res, url } = context;
// Throw an error to demonstrate the exceptionHandler middleware.
if (url.searchParams.has('throw')) {
// @ts-ignore
self.thisMethodDoesNotExist('an exception will be thrown');
}
// Eject from middleware, use FetchEvent.respondWith directly.
if (url.searchParams.has('eject')) {
context.respondWith(new Response('Ejected!', { status: 200 }));
}
res.body = `
<h1>Hello world!</h1>
<img alt="Cloudflare global network" src="https://workers.cloudflare.com/resources/illustrations/global-network.svg">
<p><a href="?throw">Throw an error</a> or <a href="?eject">eject from middleware stack</a></p>`;
res.headers.set('content-type', 'text/html');
};
new Application()
.use(exceptionHandler)
.use(requestHandler)
.listen();
git clone https://github.com/cfworker/cfworker
cd cfworker
yarn install
yarn workspace @cfworker/web cfworker run examples/worker.ts --watch
FAQs
Web framework for Cloudflare Workers and service workers, inspired by Koa and fastify
The npm package @cfworker/web receives a total of 21 weekly downloads. As such, @cfworker/web popularity was classified as not popular.
We found that @cfworker/web demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.