Changed crystal template, picked latest flask one

This commit is contained in:
2023-06-01 18:52:39 -03:00
parent f2be91d628
commit 1cc3ef2e82
22 changed files with 242 additions and 112 deletions

View File

@ -1,21 +1,7 @@
require "http/request"
require "http/headers"
require "json"
class Handler
def run(request : HTTP::Request)
if request.body.nil?
return {
body: "Foo",
status_code: 200,
headers: HTTP::Headers{"Content-Type" => "text/plain"},
}
end
{
body: "Hello, Crystal. You said: #{request.body.try(&.gets_to_end)}",
status_code: 200,
headers: HTTP::Headers{"Content-Type" => "text/plain"},
}
def run(req : String)
return JSON::Any.new("Hello, Crystal. You said: #{req}")
end
end

View File

@ -1,2 +1,7 @@
name: crystal-http-template
name: crystal_faas_function
version: 0.1.0
# dependencies:
# pg:
# github: will/crystal-pg
# version: "~> 0.5"