Skip to content

Commit 44a5623

Browse files
committed
docs: prefer bare specifiers
1 parent cba0050 commit 44a5623

File tree

1 file changed

+32
-31
lines changed

1 file changed

+32
-31
lines changed

README.md

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,19 @@ oak is available on both [deno.land/x](https://deno.land/x/oak/) and
4747
import { Application } from "https://deno.land/x/oak/mod.ts";
4848
```
4949

50-
To use from JSR, import into a module:
50+
To use from JSR, add it to your project:
5151

52-
```ts
53-
import { Application } from "jsr:@oak/oak";
52+
```
53+
deno add jsr:@oak/oak
5454
```
5555

56-
Or use the Deno CLI to add it to your project:
56+
Then import into a module:
5757

58-
```
59-
deno add jsr:@oak/oak
58+
```ts
59+
import { Application } from "@oak/oak";
6060
```
6161

62+
6263
### Node.js
6364

6465
oak is available for Node.js on both
@@ -157,7 +158,7 @@ processing requests with the registered middleware.
157158
A basic usage, responding to every request with _Hello World!_:
158159

159160
```ts
160-
import { Application } from "jsr:@oak/oak/application";
161+
import { Application } from "@oak/oak/application";
161162

162163
const app = new Application();
163164

@@ -184,7 +185,7 @@ context and reference to the "next" method in the stack.
184185
A more complex example:
185186

186187
```ts
187-
import { Application } from "jsr:@oak/oak/application";
188+
import { Application } from "@oak/oak/application";
188189

189190
const app = new Application();
190191

@@ -232,7 +233,7 @@ or `undefined` if the `ctx.respond === true`.
232233
An example:
233234

234235
```ts
235-
import { Application } from "jsr:@oak/oak/application";
236+
import { Application } from "@oak/oak/application";
236237

237238
const app = new Application();
238239

@@ -649,7 +650,7 @@ will fire a `"listen"` event, which can be listened for via the
649650
`.addEventListener()` method. For example:
650651

651652
```ts
652-
import { Application } from "jsr:@oak/oak/application";
653+
import { Application } from "@oak/oak/application";
653654

654655
const app = new Application();
655656

@@ -673,7 +674,7 @@ If you want to close the application, the application supports the option of an
673674
Here is an example of using the signal:
674675

675676
```ts
676-
import { Application } from "jsr:@oak/oak/application";
677+
import { Application } from "@oak/oak/application";
677678

678679
const app = new Application();
679680

@@ -700,9 +701,9 @@ handling middleware that provides a well managed response to errors would work
700701
like this:
701702

702703
```ts
703-
import { Application } from "jsr:@oak/oak/application";
704-
import { isHttpError } from "jsr:@oak/commons/http_errors";
705-
import { Status } from "jsr:@oak/commons/status";
704+
import { Application } from "@oak/oak/application";
705+
import { isHttpError } from "@oak/commons/http_errors";
706+
import { Status } from "@oak/commons/status";
706707

707708
const app = new Application();
708709

@@ -733,7 +734,7 @@ application. To listen for these errors, you would add an event handler to the
733734
application instance:
734735

735736
```ts
736-
import { Application } from "jsr:@oak/oak/application";
737+
import { Application } from "@oak/oak/application";
737738

738739
const app = new Application();
739740

@@ -762,8 +763,8 @@ The following example serves up a _RESTful_ service of a map of books, where
762763
`http://localhost:8000/book/1` would return the book with ID `"1"`:
763764

764765
```ts
765-
import { Application } from "jsr:@oak/oak/application";
766-
import { Router } from "jsr:@oak/oak/router";
766+
import { Application } from "@oak/oak/application";
767+
import { Router } from "@oak/oak/router";
767768

768769
const books = new Map<string, any>();
769770
books.set("1", {
@@ -814,8 +815,8 @@ Nesting routers is supported. The following example responds to
814815
`http://localhost:8000/forums/oak/posts/nested-routers`.
815816

816817
```typescript
817-
import { Application } from "jsr:@oak/oak/application";
818-
import { Router } from "jsr:@oak/oak/router";
818+
import { Application } from "@oak/oak/application";
819+
import { Router } from "@oak/oak/router";
819820

820821
const posts = new Router()
821822
.get("/", (ctx) => {
@@ -845,7 +846,7 @@ system relative to the root from the requested path.
845846
A basic usage would look something like this:
846847

847848
```ts
848-
import { Application } from "jsr:@oak/oak/application";
849+
import { Application } from "@oak/oak/application";
849850

850851
const app = new Application();
851852

@@ -881,8 +882,8 @@ determines if it can create an `ETag` header for that body type, and if so sets
881882
the `ETag` header on the response. Basic usage would look something like this:
882883

883884
```ts
884-
import { Application } from "jsr:@oak/oak/application";
885-
import { factory } from "jsr:@oak/oak/etag";
885+
import { Application } from "@oak/oak/application";
886+
import { factory } from "@oak/oak/etag";
886887

887888
const app = new Application();
888889

@@ -893,12 +894,12 @@ app.use(factory());
893894

894895
There is also a function which retrieves an entity for a given context based on
895896
what it logical to read into memory which can be passed to the etag calculate
896-
that is part of the Deno std library:
897+
that is part of the Deno std library (`deno add jsr:@std/http`):
897898

898899
```ts
899-
import { Application } from "jsr:@oak/oak/application";
900-
import { getEntity } from "jsr:@oak/oak/etag";
901-
import { calculate } from "jsr:@std/http/etag";
900+
import { Application } from "@oak/oak/application";
901+
import { getEntity } from "@oak/oak/etag";
902+
import { calculate } from "@std/http/etag";
902903

903904
const app = new Application();
904905

@@ -938,8 +939,8 @@ the handler to resolve with a Fetch API `Response`.
938939
An example of using `serve()` with `Application.prototype.use()`:
939940

940941
```ts
941-
import { Application } from "jsr:@oak/oak/application";
942-
import { serve } from "jsr:@oak/oak/serve";
942+
import { Application } from "@oak/oak/application";
943+
import { serve } from "@oak/oak/serve";
943944

944945
const app = new Application();
945946

@@ -955,9 +956,9 @@ And a similar solution works with `route()` where the context contains the
955956
information about the router, like the params:
956957

957958
```ts
958-
import { Application } from "jsr:@oak/oak/application";
959-
import { Router } from "jsr:@oak/oak/router";
960-
import { route } from "jsr:@oak/oak/serve";
959+
import { Application } from "@oak/oak/application";
960+
import { Router } from "@oak/oak/router";
961+
import { route } from "@oak/oak/serve";
961962

962963
const app = new Application;
963964

0 commit comments

Comments
 (0)