@@ -50,7 +50,13 @@ import { Application } from "https://deno.land/x/oak/mod.ts";
5050To use from JSR, import into a module:
5151
5252``` ts
53- import { Application } from " jsr:@oak/oak@14" ;
53+ import { Application } from " jsr:@oak/oak" ;
54+ ```
55+
56+ Or use the Deno CLI to add it to your project:
57+
58+ ```
59+ deno add jsr:@oak/oak
5460```
5561
5662### Node.js
@@ -60,7 +66,7 @@ oak is available for Node.js on both
6066[ JSR] ( https://jsr.io/@oak/oak ) . To use from npm, install the package:
6167
6268```
63- npm i @oakserver/oak@14
69+ npm i @oakserver/oak
6470```
6571
6672And then import into a module:
@@ -72,7 +78,7 @@ import { Application } from "@oakserver/oak";
7278To use from JSR, install the package:
7379
7480```
75- npx jsr i @oak/oak@14
81+ npx jsr i @oak/oak
7682```
7783
7884And then import into a module:
@@ -95,7 +101,7 @@ oak is available for [Cloudflare Workers](https://workers.cloudflare.com/) on
95101project:
96102
97103```
98- npx jsr add @oak/oak@14
104+ npx jsr add @oak/oak
99105```
100106
101107And then import into a module:
@@ -128,7 +134,7 @@ oak is available for Bun on [JSR](https://jsr.io/@oak/oak). To use install the
128134package:
129135
130136```
131- bunx jsr i @oak/oak@14
137+ bunx jsr i @oak/oak
132138```
133139
134140And then import into a module:
@@ -234,19 +240,10 @@ app.use((ctx) => {
234240 ctx .response .body = " Hello World!" ;
235241});
236242
237- const listener = Deno .listen ({ hostname: " localhost" , port: 8000 });
238-
239- for await (const conn of listener ) {
240- (async () => {
241- const requests = Deno .serveHttp (conn );
242- for await (const { request, respondWith } of requests ) {
243- const response = await app .handle (request , conn );
244- if (response ) {
245- respondWith (response );
246- }
247- }
248- });
249- }
243+ Deno .serve (async (request , info ) => {
244+ const res = await app .handle (request , info .remoteAddr );
245+ return res ?? Response .error ();
246+ });
250247```
251248
252249An instance of application has some properties as well:
0 commit comments