peppa/bench/tasks/02-form/repo/product/routes.mjs
2026-11-17 02:09:17 +05:00

22 lines
1011 B
JavaScript

import { html, json, page } from "./lib/http.mjs";
const home = `
<h1>Робостарт</h1>
<p>Школа робототехники для детей от 6 до 14 лет.</p>
<p><a href="/signup">Записаться на пробный урок</a></p>`;
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("Робостарт", home)) },
// Запись на пробный урок. Заявка: { childName, phone, age }.
{ method: "GET", path: "/signup", handler: ({ res }) => html(res, page("Запись на пробный урок", "<h1>Запись на пробный урок</h1><p>Скоро здесь будет форма.</p>")) },
{ method: "POST", path: "/api/signups", handler: ({ res }) => json(res, 501, { error: "Пока не сделано" }) },
];