from fasthtml import serve

from myfasthtml.controls.helpers import mk
from myfasthtml.core.commands import Command
from myfasthtml.myfastapp import create_app


# Define a simple command action
def say_hello():
  return "Hello, FastHtml!"


# Create the command
hello_command = Command("say_hello", "Responds with a greeting", say_hello)

# Create the app
app, rt = create_app(protect_routes=False)


@rt("/")
def get_homepage():
  return mk.button("Click Me!", command=hello_command)


if __name__ == "__main__":
  serve(port=5002)
