-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: updates to prep for JSR publish
- Loading branch information
Showing
15 changed files
with
100 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
# acorn | ||
|
||
[![ci](https://github.com/oakserver/acorn/workflows/ci/badge.svg)](https://github.com/oakserver/acorn) | ||
[![acorn docs](https://deno.land/badge/acorn/version)](https://deno.land/x/acorn/) | ||
|
||
Rapidly develop and iterate on RESTful APIs using a strongly typed router | ||
designed for Deno CLI and Deno Deploy. | ||
|
||
```ts | ||
import { Router } from "https://deno.land/x/acorn/mod.ts"; | ||
import { Router } from "jsr:@oak/acorn/router"; | ||
|
||
const BOOKS: Record<string, { id: number; title: string }> = { | ||
"1": { id: 1, title: "The Hound of the Baskervilles" }, | ||
|
@@ -71,20 +70,18 @@ The `.url()` method returns an instance of URL associated with the request. | |
|
||
The `.body()` method is a convenience method to deal with decoding a JSON string | ||
body. It can be used with an optional | ||
[deserializer](https://doc.deno.land/https://deno.land/x/acorn/mod.ts/~/Deserializer) | ||
which can do advanced decoding of the body, or it will attempted to be decoded | ||
from the JSON string. | ||
[deserializer](https://deno.land/x/acorn@0.4.0/mod.ts?s=Deserializer) which can | ||
do advanced decoding of the body, or it will attempted to be decoded from the | ||
JSON string. | ||
|
||
More advanced request body handling can be handled via the `.request` property. | ||
|
||
The handler is then expected to have a return value which can be a `Request` | ||
instance, a value that is a | ||
[`BodyInit`](https://doc.deno.land/deno/dom/~/BodyInit), or any other value. If | ||
an optional | ||
[serializer](https://doc.deno.land/https://deno.land/x/acorn/mod.ts/~/Serializer) | ||
is provided and the response is not a `Request` instance or of the type | ||
`BodyInit`, the value will be passed to the serializer. If no serializer is | ||
present then | ||
instance, a value that is a [`BodyInit`](https://deno.land/api?s=BodyInit), or | ||
any other value. If an optional | ||
[serializer](https://deno.land/x/[email protected]/mod.ts?s=Serializer) is provided | ||
and the response is not a `Request` instance or of the type `BodyInit`, the | ||
value will be passed to the serializer. If no serializer is present then | ||
[`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) | ||
will be used to attempt to convert the value to a JSON string. If `undefined` is | ||
returned, then a `404 NotFound` response will be generated. | ||
|
@@ -101,4 +98,4 @@ and matches the pathname part of the URL. | |
|
||
--- | ||
|
||
Copyright 2018-2023 the oak authors. All rights reserved. MIT License. | ||
Copyright 2018-2024 the oak authors. All rights reserved. MIT License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Copyright 2022-2023 the oak authors. All rights reserved. | ||
// Copyright 2022-2024 the oak authors. All rights reserved. | ||
|
||
export { assert } from "https://deno.land/std@0.212.0/assert/assert.ts"; | ||
export { assertEquals } from "https://deno.land/std@0.212.0/assert/assert_equals.ts"; | ||
export { assertRejects } from "https://deno.land/std@0.212.0/assert/assert_rejects.ts"; | ||
export { assert } from "jsr:@std/assert@0.218/assert"; | ||
export { assertEquals } from "jsr:@std/assert@0.218/assert_equals"; | ||
export { assertRejects } from "jsr:@std/assert@0.218/assert_rejects"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters