#!/usr/bin/env -S deno serve -A
import { Hono } from "jsr:@hono/hono@4";
const app = new Hono();

const data = {
    msg: "Test"
}

app.get('/', (c) => {
     return c.html(
`<html>
<head>
    <style>
      h1 {
        color: red;
        font-family: arial;
        font-size: 64px;
        width: 80%;
        margin: 20vh auto 0 auto;
        font-weight: bolder;
      }
    </style>
</head>
<body>
    <h1>${data.msg}</h1>
</body>
</html>`);
})

app.get('/msg', (c) => {
    return c.html(
`<html>
<head>
    <style>
    form {
        font-size: 64px;
        width: 80%;
        margin: 20vh auto 0 auto;
      }
    </style>
</head>
<body>
    <div>
        <form action="/input">
            <input type="text" name="msg">
            <input type="submit" value="Submit">
        </form>
     </div>
</body>
</html>`);
})

app.get('/input', (c) => {
     const { msg } = c.req.query();
     data.msg = msg;
     return c.redirect("/");
})



export default app;
