Mercurial Hosting > luan
annotate examples/blog/src/private/tools/backup.html.luan @ 1220:4721c482c86b
cleaner Db example
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Wed, 21 Mar 2018 15:54:57 -0600 |
| parents | 4c2972f4d862 |
| children | 82415c9c0015 |
| rev | line source |
|---|---|
| 1220 | 1 local Luan = require "luan:Luan.luan" |
| 2 local error = Luan.error | |
|
693
ca169567ce07
module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
597
diff
changeset
|
3 local Io = require "luan:Io.luan" |
|
ca169567ce07
module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
597
diff
changeset
|
4 local Http = require "luan:http/Http.luan" |
| 1220 | 5 local db = require("site:/lib/Db.luan").db or error() |
| 597 | 6 |
| 7 | |
| 8 return function() | |
| 9 local backup = Io.uri "site:/private/local/backup.zip" | |
| 10 backup.delete() | |
| 1220 | 11 db.zip(backup) |
| 597 | 12 |
| 13 Io.stdout = Http.response.text_writer() | |
| 1216 | 14 %> |
| 15 <!doctype html> | |
| 16 <html> | |
| 597 | 17 <body> |
| 18 backed up to <a href="/private/local/backup.zip">/private/local/backup.zip</a> | |
| 19 </body> | |
| 1216 | 20 </html> |
| 21 <% | |
| 597 | 22 end |
