const main = document.querySelector('main'), at = id => document.getElementById(id) ?? err('not found') req('PUT', '/srv/dom/'); mount('/srv/dom/', (v, p, d) => { const [, id] = p.split('/') if (!id) return v === 'GET' ? [...main.children].map(el => '=> ' + el.id).join('\n') : err('not allowed') if (v === 'PUT') return document.getElementById(id) || main.append(Object.assign(document.createElement('div'), { id })), '' if (v === 'DEL') return at(id).remove() return at(id).id }) tra({ dis: () => main.replaceChildren() })