Skip to content

Commit

Permalink
feat(CloudflareWorkerServer): rename fetchHandler to fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
Snazzah committed Oct 27, 2023
1 parent 425c108 commit 45192fa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/servers/cfworker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export class CloudflareWorkerServer extends Server {
}

/**
* The fetch handler for the server. Export this as your fetch handler to utilize this server.
* The fetch handler for the server. Either export the server as default or use this function in your fetch handler to utilize this server.
* @example
* export const workerServer = new CloudflareWorkerServer();
* creator.withServer(workerServer);
* export default { fetch: workerServer.fetchHandler }
* export default workerServer;
*/
readonly fetchHandler = async (request: WorkerRequest, env: Record<string, object>, ctx: ExecutionContext) => {
readonly fetch = async (request: WorkerRequest, env: Record<string, object>, ctx: ExecutionContext) => {
if (!this._handler) return new Response('Server has no handler.', { status: 503 });
if (request.method !== 'POST') return new Response('Server only supports POST requests.', { status: 405 });
const body = await request.text();
Expand Down

0 comments on commit 45192fa

Please sign in to comment.