21 lines
1.0 KiB
JavaScript
21 lines
1.0 KiB
JavaScript
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: "Пока не сделано" }) },
|
||
];
|