From e66c0d3b386e6d6ae4ae03d56d14f658277612e2 Mon Sep 17 00:00:00 2001 From: Pradip Kumar acharya Date: Sat, 21 Mar 2026 21:04:51 +0530 Subject: [PATCH 1/2] add basic writing editor with backend save --- App.tsx | 41 +++++++++++++++++++++++++++++++++++++++++ server.ts | 29 +++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 App.tsx create mode 100644 server.ts diff --git a/App.tsx b/App.tsx new file mode 100644 index 000000000..e2fdb4f3e --- /dev/null +++ b/App.tsx @@ -0,0 +1,41 @@ +import { useState } from 'react' + +function Editor() { + const [text, setText] = useState('') + const [msg, setMsg] = useState('') + + function handleChange(e: any) { + setText(e.target.value) + } + + async function saveText() { + const res = await fetch('http://localhost:3000/save', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ text: text }) + }) + const data = await res.json() + if (data.msg == 'saved') { + setMsg('saved!') + } + } + + return ( +
+

Vi-Notes

+