Skip to content

Commit

Permalink
Adding example for Sanic
Browse files Browse the repository at this point in the history
  • Loading branch information
Zohaib Sibte Hassan committed Dec 25, 2023
1 parent d1b21d0 commit 070beb2
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,37 @@ def header(account: AccountInfo) -> DOMElement:
domx.h1(f"Welcome {account.name}"),
hamburger(account) # Reusing another component
)
```

### More usage examples:

Here is an example app Sanic:

```python
from sanic import Sanic, html
from htmxido import domx as x

app = Sanic("Pythia")

@app.post("/clicked")
async def clicked(request):
return html(str(
x.div("Clicked!!!")
))

@app.get("/")
async def home(request):
return html(str(
x.html(
x.head(
x.script(src="https://unpkg.com/[email protected]")
),
x.body(
x.h1("Running htmxido"),
x.div(id="container")(
x.button("Reveal!!!", hxTarget="#container", hxTrigger="click", hxPost="/clicked")
),
)
)
))
```

0 comments on commit 070beb2

Please sign in to comment.