// ── Public · Rust — the handlers ────────────────────────────────────────── // // Thin on purpose: read the request, call a model, answer. Everything worth // testing is in the model, which needs no express and no database to test. // // **A handler must not throw past express.** Core mounts this router inside its // own tier router, so an unhandled rejection here reaches core's error handler // and answers 500 — survivable, but it means an operator sees core blamed for a // fault in this module. Catch, log through `core.logger` (so the line carries the // module id), and answer something honest. const core = require('../../core') const servers = require('../../model/servers/servers.model') const log = core.logger('public') async function listServers(req, res) { try { res.json({ servers: await servers.listPublic() }) } catch (err) { log.error('failed to read the server list', { error: err.message }) res.status(500).json({ error: 'Failed to read the server list' }) } } module.exports = { listServers }