From 55699f07278c56f16962a3b7d02791ad8005fadc Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Mon, 9 Feb 2026 11:53:49 +0100 Subject: [PATCH] feat: add a server for querying notes --- CLAUDE.md | 107 ---------------------------------------- Dockerfile | 8 +-- deno.json | 5 +- main.ts => jetstream.ts | 0 server.ts | 2 +- 5 files changed, 10 insertions(+), 112 deletions(-) delete mode 100644 CLAUDE.md rename main.ts => jetstream.ts (100%) diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index a399ce6..0000000 --- a/CLAUDE.md +++ /dev/null @@ -1,107 +0,0 @@ -# Claude - -Default to using Bun instead of Node.js. - -- Use `bun ` instead of `node ` or `ts-node ` -- Use `bun test` instead of `jest` or `vitest` -- Use `bun build ` instead of `webpack` or `esbuild` -- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install` -- Use `bun run - - -``` - -With the following `frontend.tsx`: - -```tsx#frontend.tsx -import React from "react"; -import { createRoot } from "react-dom/client"; - -// import .css files directly and it works -import './index.css'; - -const root = createRoot(document.body); - -export default function Frontend() { - return

Hello, world!

; -} - -root.render(); -``` - -Then, run index.ts - -```sh -bun --hot ./index.ts -``` - -For more information, read the Bun API docs in `node_modules/bun-types/docs/**.mdx`. diff --git a/Dockerfile b/Dockerfile index ca9b281..8aa720b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM denoland/deno:2 +FROM denoland/deno:latest WORKDIR /app @@ -6,10 +6,12 @@ COPY deno.json deno.lock ./ RUN deno install COPY . . -RUN deno cache main.ts +RUN deno cache jetstream.ts server.ts RUN mkdir -p /data VOLUME /data ENV SQLITE_PATH=/data/notes.db -CMD ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "--allow-env", "main.ts"] +EXPOSE 8080 + +CMD ["sh", "-c", "deno task jetstream:prod & deno task server:prod"] diff --git a/deno.json b/deno.json index 3511c9c..f739e7a 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,9 @@ { "tasks": { - "dev": "deno run --watch --allow-net --allow-read --allow-write main.ts", + "jetstream:prod": "deno run --allow-net --allow-read --allow-write --allow-env jetstream.ts", + "jetstream": "deno run --watch --allow-net --allow-read --allow-write --allow-env jetstream.ts", + "server": "deno run --watch --allow-net server.ts", + "server:prod": "deno run --allow-net server.ts", "migrate": "deno run --allow-read --allow-write src/migrations/init.ts" }, "imports": { diff --git a/main.ts b/jetstream.ts similarity index 100% rename from main.ts rename to jetstream.ts diff --git a/server.ts b/server.ts index 5b7125a..1892313 100644 --- a/server.ts +++ b/server.ts @@ -10,4 +10,4 @@ const app = new Application(); app.use(router.routes()); app.use(router.allowedMethods()); -app.listen(); +app.listen({port: 8080});