htmx_examples/README.md

1.5 KiB

Enjoy the HTMX examples rendered with Flask!

Install

git clone
cd /htmx-examples-with-flask
pipenv install

Run

./run

Use

What is where

@app.route("/examples/click-to-edit/")
def get_click_to_edit():
  • It is followed by additional routes, as the example requires, e.g.
@app.route(
  "/contact/<int:id>",
  methods=['GET'])
def get_contact(id):

@app.route(
  "/contact/<int:id>",
  methods=['PUT'])
def put_contact(id):

Other notes

Sample data is in contacts.json. There are simple routines to read and write to it. Not safe, not production ready, etc. If you think that using something production-like, e.g. a DB would make more sense for the examples please let me know. My thinking so far is that it will only clutter the examples codebase.

Not super-easy?

If the examples' implementation is not super-easy to install and figure out, please write me to tell me what makes it difficult.

Thanks!