Examples from building the Contacts app in the book Hypermedia Systems.
The code here is slightly different from the book, as I try to use types where I can, and check for them using Mypy, a static type checker for Python.
PyTest is used for testing. While inside an example directory simply run pytest
to run the tests for that example.
Clone the repo...
git clone https://github.com/juliojimenez/hypermedia.systems
cd hypermedia.systems
Install dependencies...
pip3 install -r requirements.txt
Go to an example...
cd chapter-3/1-simple-hello-world/
And run it...
python3 app.py
Each example runs on a different port. Run multiple examples simultaneously and compare them in the browser!
- Simple Hello World
- Simple Hello World to a Redirect
- Showing a Searchable List of Contacts
- Adding a New Contact
- Viewing the Details of a Contact
- Editing a Contact
- Deleting a Contact
- Installing HTMX as a Third Party Dependency
- Triggering HTTP Requests
- HTMX vs. Plain HTML Responses
- Targeting Other Elements
- Swap Styles
- Using Events
- Passing Request Parameters
- History Support
- Installing HTMX as a Vendored Dependency
- Adding hx-boost to Contacts.app
- A Second Step: Deleting Contacts With HTTP DELETE
- Next Steps: Validating Contact Emails
- Another Application Improvement: Paging
- Beginning Our Implementation
- Adding The Archiving Endpoing
- Conditionally Rendering A Progress UI
- Using Polling To Update The Archive UI
- Downloading The Result
- Downloading The Completed Archive
- Our Smoothing Solution
- Dismissing The Download UI
- An Alternative UX: Auto-Download
- VanillaJS in Action: An Overflow Menu
- Alpine.js
- _hyperscript
- Integrating Using Callbacks
- Integrating Using Events
- Our First JSON Endpoint: Listing All Contacts
- Adding Contacts
- Viewing Contact Details
- Updating & Deleting Contacts
Python 3.11+