peppa/bench/tasks/05-external-api/repo/product/routes.mjs
Асель d108197f0f PEP-184: задачи 5–8, тест набора, archive change, память
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 02:09:17 +05:00

21 lines
1.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { html, json, page } from "./lib/http.mjs";
export const routes = [
{
method: "GET",
path: "/healthz",
handler: ({ res }) => {
res.writeHead(200, { "content-type": "text/plain; charset=utf-8" });
res.end("ok");
},
},
{
method: "GET",
path: "/",
handler: ({ res }) => html(res, page("Обменный пункт «Достык»", '<h1>Обменный пункт «Достык»</h1><p>Алматы, пр. Достык, 5. Ежедневно 9:00–21:00.</p><p><a href="/convert">Калькулятор обмена</a></p>')),
},
{ method: "GET", path: "/convert", handler: ({ res }) => html(res, page("Калькулятор обмена", "<h1>Калькулятор обмена</h1><p>Скоро здесь будет калькулятор.</p>")) },
// Пересчёт: GET /api/convert?amount=10000&to=USD → { amount, to, rate, result } (result — до сотых).
{ method: "GET", path: "/api/convert", handler: ({ res }) => json(res, 501, { error: "Пока не сделано" }) },
];