cd demo/endpoint
# develop: a temporary URL with hot reload; edit app.py and the next request uses the new code
levers9 serve app.py:greet
# in another terminal, using the URL that `serve` prints, or the deployed one below
# deploy
levers9 deploy app.py:greet --name greet
# call it
TOKEN=$(awk -F' = ' '/^\[default\]/{f=1} f&&/^token/{print $2; exit}' ~/.levers9/config)
curl -s -X POST localhost:1994/endpoint/greet/v1 \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"name": "Levers", "shout": true}'
# {"message":"HELLO, LEVERS","host":"...","at":...}
# smoke test: runs the handler locally in this process, no container
python app.py
# manage
levers9 deployment list
levers9 deployment stop `deployment id`