Skip to content

Commit 42b99db

Browse files
committed
update package manager info
1 parent 210ee68 commit 42b99db

File tree

7 files changed

+130
-15
lines changed

7 files changed

+130
-15
lines changed

deno.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
"tailwindcss/": "npm:/[email protected]/",
3232
"tailwindcss/plugin": "npm:/[email protected]/plugin.js",
3333
"@deno/gfm": "jsr:/@deno/[email protected]",
34-
"$std/": "https://deno.land/std@0.216.0/"
34+
"@std/dotenv/": "jsr:/@std/dotenv@^0.225/"
3535
},
3636
"compilerOptions": {
3737
"jsx": "react-jsx",
3838
"jsxImportSource": "preact"
3939
},
40-
"nodeModulesDir": true
40+
"nodeModulesDir": "auto"
4141
}

dev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
import dev from "$fresh/dev.ts";
44
import config from "./fresh.config.ts";
55

6-
import "$std/dotenv/load.ts";
6+
import "@std/dotenv/load";
77

88
await dev(import.meta.url, "./main.ts", config);

islands/PMSelect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export default function PMSelect(
125125
</nav>
126126
<div>
127127
<div id="pm-deno-content" class="my-4">
128-
<CopyText text={`deno add ${pkg}`} />
128+
<CopyText text={`deno add jsr:${pkg}`} />
129129
</div>
130130
<div id="pm-npm-content" class="my-4">
131131
<CopyText text={`npx jsr add ${pkg}`} />

main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/// <reference lib="dom.asynciterable" />
55
/// <reference lib="deno.ns" />
66

7-
import "$std/dotenv/load.ts";
7+
import "@std/dotenv/load";
88

99
import { start } from "$fresh/server.ts";
1010
import manifest from "./fresh.gen.ts";

routes/acorn.tsx

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function Acorn() {
3333
<section class="bg-white dark:bg-gray-900">
3434
<div class="gap-8 items-center py-8 px-4 mx-auto max-w-screen-xl xl:gap-16 md:grid md:grid-cols-2 sm:py-16 lg:px-6">
3535
<img
36-
class="w-full p-8 lg:p-20 xl:p-32"
36+
class="w-full p-6 lg:p-18 xl:p-24"
3737
src="/acorn_logo.svg"
3838
alt="an icon of an acorn"
3939
/>
@@ -62,6 +62,15 @@ export default function Acorn() {
6262
Cloudflare Workers
6363
</a>.
6464
</p>
65+
<div class="pb-6">
66+
<a
67+
href="https://dash.deno.com/playground/acorn-playground"
68+
target="_blank"
69+
class="inline-flex items-center text-white bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:focus:ring-primary-900"
70+
>
71+
Visit the playground
72+
</a>
73+
</div>
6574
<PMSelect pkg="@oak/acorn" />
6675
</div>
6776
</div>
@@ -72,8 +81,14 @@ export default function Acorn() {
7281
code={`import { Router } from "@oak/acorn";
7382
7483
const BOOKS = {
75-
"1": { id: 1, title: "The Hound of the Baskervilles" },
76-
"2": { id: 2, title: "It" },
84+
"1": {
85+
title: "The Hound of the Baskervilles",
86+
author: "Doyle, Arthur Conan",
87+
},
88+
"2": {
89+
title: "It",
90+
author: "King, Stephen",
91+
},
7792
};
7893
7994
const router = new Router();
@@ -86,7 +101,7 @@ router.listen({ port: 3000 });
86101
/>
87102
<div class="mt-4 md:mt-0">
88103
<h2 class="mb-4 text-4xl tracking-tight font-extrabold text-gray-900 dark:text-white">
89-
Rapidly create endpoints
104+
Rapidly create APIs
90105
</h2>
91106
<p class="mb-6 font-light text-gray-500 md:text-lg dark:text-gray-400">
92107
acorn focuses on the primary use case of handling JSON data in a
@@ -102,11 +117,62 @@ router.listen({ port: 3000 });
102117
</div>
103118
</div>
104119
</section>
120+
<section class="bg-white dark:bg-gray-900">
121+
<div class="gap-8 items-center py-8 px-4 mx-auto max-w-screen-xl xl:gap-16 md:grid md:grid-cols-2 sm:py-16 lg:px-6">
122+
<div class="mt-4 md:mt-0">
123+
<h2 class="mb-4 text-4xl tracking-tight font-extrabold text-gray-900 dark:text-white">
124+
Integrated data validation
125+
</h2>
126+
<p class="mb-6 font-light text-gray-500 md:text-lg dark:text-gray-400">
127+
acorn includes a schema validation system via{" "}
128+
<a href="https://valibot.dev/" target="_blank" class="underline">
129+
Valibot
130+
</a>{" "}
131+
for requests and responses, making it easy to ensure your API is
132+
consistent.
133+
</p>
134+
<a
135+
href="https://jsr.io/@oak/acorn/doc/~/SchemaDescriptor"
136+
target="_blank"
137+
class="inline-flex items-center text-white bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:focus:ring-primary-900"
138+
>
139+
See the docs
140+
</a>
141+
</div>
142+
<CodeBlock
143+
code={`import { Router, Status, v } from "@oak/acorn";
144+
145+
const router = new Router();
146+
const db = await Deno.openKv();
147+
148+
const book = v.object({
149+
author: v.string(),
150+
title: v.string(),
151+
});
152+
153+
router.get("/book/:id", async (ctx) => {
154+
const maybeBook = await db.get(["books", ctx.params.id]);
155+
if (!maybeBook) {
156+
ctx.throw(Status.NotFound, "Book not found");
157+
}
158+
return maybeBook.value;
159+
}, { schema: { response: book } });
160+
161+
router.put("/book/:id", async (ctx) => {
162+
const body = await ctx.body();
163+
await db.set(["books", ctx.params.id], body);
164+
return book;
165+
}, { schema: { body: book, response: book } });
166+
167+
router.listen({ port: 3000 });`}
168+
/>
169+
</div>
170+
</section>
105171
<footer class="p-4 bg-white sm:p-6 dark:bg-gray-800">
106172
<div class="mx-auto max-w-screen-xl">
107173
<div class="md:flex md:justify-between">
108174
<div class="mb-6 md:mb-0">
109-
<a href="https://flowbite.com" class="flex items-center">
175+
<a href="/" class="flex items-center">
110176
<img
111177
src="/oak_logo_head.svg"
112178
class="mr-3 h-8"

static/acorn-social.png

14.4 KB
Loading

static/acorn_logo.svg

Lines changed: 54 additions & 5 deletions
Loading

0 commit comments

Comments
 (0)