diff --git a/.vscode/settings.json b/.vscode/settings.json index 11ad0a3..bc6163c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "deno.enable": true, + "deno.unstable": true, "deno.inlayHints.variableTypes.enabled": false, "deno.inlayHints.parameterNames.enabled": "none", "deno.inlayHints.parameterTypes.enabled": false, diff --git a/deno.json b/deno.json index a648fc8..2743ccb 100644 --- a/deno.json +++ b/deno.json @@ -3,7 +3,7 @@ "tasks": { "win": "deno run --watch=static/,routes/ --allow-env --allow-read --allow-write=.,$LOCALAPPDATA/Temp --allow-run=$(where deno),$LOCALAPPDATA/Cache/esbuild/bin/esbuild-windows-64@0.14.51 --allow-net=:8000,deno.land,esm.sh,accounts.google.com,www.googleapis.com,cdn.jsdelivr.net,$PGHOST dev.ts", "arm": "deno run --watch=static/,routes/ --allow-env --allow-read --allow-write=.,/tmp --allow-run=$(which deno),$HOME/.cache/esbuild/bin/esbuild-linux-arm64@0.14.51 --allow-net=:8000,deno.land,esm.sh,accounts.google.com,www.googleapis.com,cdn.jsdelivr.net,$PGHOST dev.ts", - "linux": "deno run --watch=static/,routes/ --allow-env --allow-read --allow-write=.,$HOME/.cache/fresh --allow-run=$(which deno),$HOME/.cache/esbuild/bin/@esbuild-linux-x64@0.18.11 --allow-net=:8000,deno.land,dl.deno.land,esm.sh,accounts.google.com,www.googleapis.com,cdn.jsdelivr.net,$PGHOST dev.ts", + "linux": "deno run --unstable --watch=static/,routes/ --allow-env --allow-read --allow-write=.,$HOME/.cache/fresh --allow-run=$(which deno),$HOME/.cache/esbuild/bin/@esbuild-linux-x64@0.18.11 --allow-net=:8000,deno.land,dl.deno.land,esm.sh,accounts.google.com,www.googleapis.com,cdn.jsdelivr.net,$PGHOST dev.ts", "update": "deno run -A -r https://fresh.deno.dev/update .", "build": "deno run --allow-env --allow-read --allow-write=.,$HOME/.cache/fresh,$HOME/.cache/esbuild --allow-run=$(which deno),$HOME/.cache/esbuild/bin/@esbuild-linux-x64@0.18.11 --allow-net=deno.land,dl.deno.land,esm.sh,cdn.jsdelivr.net,registry.npmjs.org dev.ts build", "preview": "deno run -A main.ts" @@ -48,4 +48,4 @@ "_fresh" ] } -} \ No newline at end of file +} diff --git a/main.ts b/main.ts index 2a7af93..502d7f9 100644 --- a/main.ts +++ b/main.ts @@ -3,6 +3,7 @@ /// /// /// +/// import { start } from "$fresh/server.ts"; import manifest from "~/fresh.gen.ts"; @@ -14,6 +15,16 @@ import { env } from "~/server/env.ts"; // render(); // }; +const kv = await Deno.openKv(); + +// Persist an object at the users/alice key. +await kv.set(["users", "alice"], { name: "Alice" }); + +// Read back this key. +const res = await kv.get(["users", "alice"]); +console.log(res.key); // [ "users", "alice" ] +console.log(res.value); // { name: "Alice" } + env.init(); initPool(); await start(manifest);