Skip to content
Myr

refactor: use arrow func for `app.fetch` (#348)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Yusuke Wada · committed by GitHub · parent eda96e7 · Browse files · 4 files+6 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+6 added−6 removed

  • other:+6 added−6 removed

4 files+6 added−6 removed

modified:deno_dist/hono.ts+1 added-1 removed
196 unmodified lines
197 async handleEvent(event: FetchEvent): Promise<Response> {198 return this.dispatch(event.request, event)199 }200201 async fetch(request: Request, env?: E, executionCtx?: ExecutionContext): Promise<Response> {201 fetch = async (request: Request, env?: E, executionCtx?: ExecutionContext) => {202 return this.dispatch(request, executionCtx, env)203 }204205 request(input: RequestInfo, requestInit?: RequestInit): Promise<Response> {
4 unmodified lines
modified:deno_dist/README.md+2 added-2 removed
760 unmodified lines
761Hono also works with Deno. This feature is still experimental.762763```tsx764/** @jsx jsx */765import { serve } from 'https://deno.land/std@0.146.0/http/server.ts'765import { serve } from 'https://deno.land/std/http/server.ts'766import { Hono, logger, poweredBy, serveStatic, jsx } from 'https://deno.land/x/hono/mod.ts'767768const app = new Hono()769
3 unmodified lines
773app.get('/', (c) => {774 return c.html(<h1>Hello Deno!</h1>)775})776777serve((req) => app.fetch(req))777serve(app.fetch)778```779780## Related projects781
31 unmodified lines
modified:src/hono.ts+1 added-1 removed
196 unmodified lines
197 async handleEvent(event: FetchEvent): Promise<Response> {198 return this.dispatch(event.request, event)199 }200201 async fetch(request: Request, env?: E, executionCtx?: ExecutionContext): Promise<Response> {201 fetch = async (request: Request, env?: E, executionCtx?: ExecutionContext) => {202 return this.dispatch(request, executionCtx, env)203 }204205 request(input: RequestInfo, requestInit?: RequestInit): Promise<Response> {
4 unmodified lines
modified:README.md+2 added-2 removed
760 unmodified lines
761Hono also works with Deno. This feature is still experimental.762763```tsx764/** @jsx jsx */765import { serve } from 'https://deno.land/std@0.146.0/http/server.ts'765import { serve } from 'https://deno.land/std/http/server.ts'766import { Hono, logger, poweredBy, serveStatic, jsx } from 'https://deno.land/x/hono/mod.ts'767768const app = new Hono()769
3 unmodified lines
773app.get('/', (c) => {774 return c.html(<h1>Hello Deno!</h1>)775})776777serve((req) => app.fetch(req))777serve(app.fetch)778```779780## Related projects781
31 unmodified lines