// ── Public · Rust ───────────────────────────────────────────────────────── // // Mounted at `/api/v1/public/rust` by `index.js`. One express Router, built from // CORE's express (`core.express`) — never from a `require('express')` of your // own, which would not resolve from here anyway (MODULE_API.md §7.2). // // **The tier's gate is already on.** This router sits inside core's public tier, // which is behind nothing by design. Per-route middleware goes on top, and // `siteMode` is the one worth understanding: it is what makes a route respect the // operator's maintenance switch. Core applies it to its own content routes and // deliberately does not apply it to its status endpoints, because status is // exactly what an operator wants visible *during* maintenance. // // The server list is content, not status — it is the module's landing page — so // it takes `siteMode`. // // ── About the `#swagger` comments ───────────────────────────────────────── // // They are not documentation *of* the code; they are the source the OpenAPI // fragment is generated from (`npm run swagger`, §2.8). swagger-autogen reads // them as JavaScript literals it evaluates, so a QUOTE CHARACTER inside a // single-quoted description ends the string early — and the failure is silent: // the value is truncated at that character while the generator prints success. // Use a typographic apostrophe (’) in prose. A backtick is fine. const core = require('../../core') const express = core.express const servers = require('./rust.controller') const { siteMode } = core.middleware const rustRouter = express.Router() rustRouter.get( '/servers', // #swagger.tags = ['Public · Rust'] // #swagger.summary = 'Every Rust server this site follows' // #swagger.description = 'The operator’s configured Rust servers and what each one last reported. Answers with `online: false` and `stale: true` rather than failing when a game server or its sidecar is unreachable — the site’s availability does not depend on the game’s.' /* #swagger.responses[200] = { description: 'The server list', content: { "application/json": { schema: { $ref: "#/components/schemas/RustServerList" } } } } */ siteMode, servers.listServers, ) module.exports = rustRouter