@@ -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
7483const 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
7994const 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"
0 commit comments