A zero-dependency AT Protocol Personal Data Server written in JavaScript
atproto pds

chore: remove test endpoints, clean up routing

Removed /test/* endpoints, added proper 404 JSON response.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Changed files
+1 -43
src
+1 -43
src/pds.js
··· 633 633 634 634 async fetch(request) { 635 635 const url = new URL(request.url) 636 - if (url.pathname === '/test/cbor') { 637 - const encoded = cborEncode({ hello: 'world', num: 42 }) 638 - return new Response(encoded, { 639 - headers: { 'content-type': 'application/cbor' } 640 - }) 641 - } 642 - if (url.pathname === '/test/cid') { 643 - const data = cborEncode({ test: 'data' }) 644 - const cid = await createCid(data) 645 - return Response.json({ cid: cidToString(cid) }) 646 - } 647 - if (url.pathname === '/test/tid') { 648 - const tids = [createTid(), createTid(), createTid()] 649 - return Response.json({ tids }) 650 - } 651 - if (url.pathname === '/test/schema') { 652 - const tables = this.sql.exec(` 653 - SELECT name FROM sqlite_master WHERE type='table' ORDER BY name 654 - `).toArray() 655 - return Response.json({ tables: tables.map(t => t.name) }) 656 - } 657 - if (url.pathname === '/test/sign') { 658 - const kp = await generateKeyPair() 659 - const data = new TextEncoder().encode('test message') 660 - const key = await importPrivateKey(kp.privateKey) 661 - const sig = await sign(key, data) 662 - return Response.json({ 663 - publicKey: bytesToHex(kp.publicKey), 664 - signature: bytesToHex(sig) 665 - }) 666 - } 667 - if (url.pathname === '/test/mst') { 668 - // Insert some test records 669 - this.sql.exec(`INSERT OR REPLACE INTO records VALUES (?, ?, ?, ?, ?)`, 670 - 'at://did:plc:test/app.bsky.feed.post/abc', 'cid1', 'app.bsky.feed.post', 'abc', new Uint8Array([1])) 671 - this.sql.exec(`INSERT OR REPLACE INTO records VALUES (?, ?, ?, ?, ?)`, 672 - 'at://did:plc:test/app.bsky.feed.post/def', 'cid2', 'app.bsky.feed.post', 'def', new Uint8Array([2])) 673 - 674 - const mst = new MST(this.sql) 675 - const root = await mst.computeRoot() 676 - return Response.json({ root }) 677 - } 678 636 if (url.pathname === '/init') { 679 637 const body = await request.json() 680 638 if (!body.did || !body.privateKey) { ··· 777 735 778 736 return new Response(null, { status: 101, webSocket: client }) 779 737 } 780 - return new Response('pds running', { status: 200 }) 738 + return Response.json({ error: 'not found' }, { status: 404 }) 781 739 } 782 740 } 783 741