// Save as preferences-fixture.cjs, then run: node preferences-fixture.cjs const http = require('node:http'); const server = http.createServer((req, res) => { const { pathname, searchParams } = new URL(req.url, 'http://localhost'); if (pathname === '/api/preferences') { res.writeHead(200, { 'Content-Type': 'application/json' }); return res.end(JSON.stringify({ theme: 'light' })); } if (pathname !== '/') { res.writeHead(404, { 'Content-Type': 'application/json' }); return res.end(JSON.stringify({ error: 'unknown route' })); } const endpoint = searchParams.get('stage') === 'after' ? '/api/preferences' : '/api/prefences'; res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' }); res.end(` Preferences debug fixture

No-account debugging fixture

Preferences

Requests one example setting from a local endpoint.

Loading preferences
`); }); server.listen(Number(process.env.FIXTURE_PORT || 0), '127.0.0.1', () => { console.log('http://127.0.0.1:' + server.address().port); });