// ── Public · World — 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 your router inside its // own tier router, so an unhandled rejection here reaches core's error handler // and answers 500 — which is survivable, but it means an operator sees core // blamed for a fault in your module. Catch, log through `core.logger` (so the // line carries your module id), and answer something honest. const core = require('../../core') const worldStatus = require('../../model/worldStatus/worldStatus.model') const log = core.logger('world') async function getStatus(req, res) { try { res.json(await worldStatus.getPublicStatus()) } catch (err) { log.error('failed to read world status', { error: err.message }) res.status(500).json({ error: 'Failed to read world status' }) } } module.exports = { getStatus }