Alpine-based crystal-http template
This commit is contained in:
12
template/crystal-http/function/handler.cr
Normal file
12
template/crystal-http/function/handler.cr
Normal file
@ -0,0 +1,12 @@
|
||||
require "http/request"
|
||||
require "http/headers"
|
||||
|
||||
class Handler
|
||||
def run(request : HTTP::Request)
|
||||
{
|
||||
body: "Hello, Crystal. You said: #{request.body.try(&.gets_to_end)}",
|
||||
status_code: 200,
|
||||
headers: HTTP::Headers{"Content-Type" => "text/plain"},
|
||||
}
|
||||
end
|
||||
end
|
2
template/crystal-http/function/shard.yml
Normal file
2
template/crystal-http/function/shard.yml
Normal file
@ -0,0 +1,2 @@
|
||||
name: crystal-http-template
|
||||
version: 0.1.0
|
Reference in New Issue
Block a user