import { APIUtils } from "../apiutils.ts"; import { Config } from "../config.ts"; const config = Config.getConfig() as Config.GalvanicConfiguration; const protocol = config.web.securepublichost ? 'https' : 'http'; export const route = APIUtils.createRouter('/ns'); type NameserverHosts = { Auth: string, API: string, WWW: string, Notifications: string, Images: string, CDN: string, Commerce: string, Matchmaking: string, Storage: string, Chat: string, Leaderboard: string } const nameserver: NameserverHosts = { Auth: `${protocol}://${config.web.publichost}/auth`, API: `${protocol}://${config.web.publichost}`, WWW: `${protocol}://${config.web.publichost}`, Notifications: `${protocol}://${config.web.publichost}/notify`, Images: `${protocol}://${config.web.publichost}/img`, CDN: `${protocol}://${config.web.publichost}/cdn`, Commerce: `${protocol}://${config.web.publichost}/commerce`, Matchmaking: `${protocol}://${config.web.publichost}/match`, Storage: `${protocol}://${config.web.publichost}/storage`, Chat: `${protocol}://${config.web.publichost}/chat`, Leaderboard: `${protocol}://${config.web.publichost}/leaderboard` } route.router.get('*', (_rq, rs) => { rs.json(nameserver); });