annotate examples/blog/src/delete.luan @ 2024:fa8304b060d9
 
rename launching luan files
 | author | 
 Franklin Schmidt <fschmidt@gmail.com> | 
 | date | 
 Wed, 29 Oct 2025 21:12:53 -0600 | 
 | parents | 
 bc40bc9aab3a  | 
 | children | 
  | 
 | rev | 
   line source | 
  
| 
1387
 | 
     1 local Luan = require "luan:Luan.luan"
 | 
| 
 | 
     2 local error = Luan.error
 | 
| 
 | 
     3 local String = require "luan:String.luan"
 | 
| 
 | 
     4 local to_number = String.to_number or error()
 | 
| 
 | 
     5 local Http = require "luan:http/Http.luan"
 | 
| 
 | 
     6 local Post = require "site:/lib/Post.luan"
 | 
| 
 | 
     7 
 | 
| 
 | 
     8 
 | 
| 
 | 
     9 return function()
 | 
| 
 | 
    10 	local post_id = to_number(Http.request.parameters.post) or error()
 | 
| 
 | 
    11 	Post.delete_by_id(post_id)
 | 
| 
 | 
    12 	Http.response.send_redirect("/")
 | 
| 
 | 
    13 end
 |