MCPcopy Create free account
hub / github.com/TanStack/devtools / readTodos

Function readTodos

examples/react/start/src/routes/demo/start.server-funcs.tsx:19–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17const TODOS_FILE = 'todos.json'
18
19async function readTodos() {
20 return JSON.parse(
21 await fs.promises.readFile(TODOS_FILE, 'utf-8').catch(() =>
22 JSON.stringify(
23 [
24 { id: 1, name: 'Get groceries' },
25 { id: 2, name: 'Buy a new phone' },
26 ],
27 null,
28 2,
29 ),
30 ),
31 )
32}
33
34const getTodos = createServerFn({
35 method: 'GET',

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected