Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 1.21 KB

README.md

File metadata and controls

23 lines (18 loc) · 1.21 KB

Sample Flask REST tasklist written in Hy

Rewrote in Hy and with sqlite support the app built in this tutorial. Hy is a Lisp dialect that compiles into Python AST.

You'll need to set up a sqlite database in the directory named tasks.db and create this table: CREATE TABLE task(id smallint, title varchar(20), description varchar(200), done smallint);. I will be adding some better db management and setup using SQLAlchemy next!

To run:

./main.py

To try it out:

curl -i -u foo:bar -X GET 127.0.0.1:5000/todo/api/v1.0/tasks
curl -i -u foo:bar -X GET 127.0.0.1:5000/todo/api/v1.0/tasks/1
curl -i -u foo:bar -X POST -H "Content-Type: application/json" 127.0.0.1:5000/todo/api/v1.0/tasks -d '{"title": "buy milk"}'
curl -i -u foo:bar -X PUT -H "Content-Type: application/json" 127.0.0.1:5000/todo/api/v1.0/tasks/2 -d '{"done":true}'
curl -i -u foo:bar -X DELETE 127.0.0.1:5000/todo/api/v1.0/tasks/2

Sources: