askrobots / dbbasic-examples
Public
Example DBBasic apps (an API, a blog and a microblog) and a template for new DBBasic modules.
danq9
Add official module template for creating DBBasic packages
17cf88a
1 year, 1 month ago
History
api.py · 318 bytes · 9 lines
| 1 | from dbbasic.tsv import TSV |
| 2 | from dbbasic_web.responses import html |
| 3 | from dbbasic_web.templating import render |
| 4 | |
| 5 | def handle(request): |
| 6 | posts = TSV("posts", ["id", "title", "content", "author", "created"]) |
| 7 | all_posts = list(posts.all()) |
| 8 | all_posts.reverse() |
| 9 | return html(render('index.html', posts=all_posts)) |